Expected Earnings Predictions Indicator for ThinkorSwim

MBF

MBF

Active member
2019 Donor
This indicator will show you where expected earnings should hit. I use it on a daily and mark out the lines because I day trade and don't want more indicators on my charts. It also has spread predictions for those of you who are above my brain capacity at the moment.

Speaking with the person I received it from it will either go up to that line or down depending on markets reactions to earnings, no in between.
I watched it and it seemed to even go past some of the earning predictions. Kind of dig it. There are hints within the script.

thinkScript Code

Code:
input price = close;

input aggregationPeriod = AggregationPeriod.DAY;

def onExpansion = if IsNaN(close) then yes else no;

#third friday calc

def series = 1;

Assert(series > 0, "'series' must be positive: " + series);

def showonlytoday = yes;

def CurrentYear = GetYear();

def CurrentMonth = GetMonth();

def CurrentDOM = GetDayOfMonth(GetYYYYMMDD());

def Day1DOW1 = GetDayOfWeek(CurrentYear * 10000 + CurrentMonth * 100 + 1);

def FirstFridayDOM1 = if Day1DOW1 < 6

then 6 - Day1DOW1

else if Day1DOW1 == 6

then 7

else 6;

def RollDOM = FirstFridayDOM1 + 14;

def ExpMonth1 = if RollDOM > CurrentDOM

then CurrentMonth + series - 1

else CurrentMonth + series;

def ExpMonth2 = if ExpMonth1 > 12

then ExpMonth1 - 12

else ExpMonth1;

def ExpYear = if ExpMonth1 > 12

then CurrentYear + 1

else CurrentYear;

def Day1DOW = GetDayOfWeek(ExpYear * 10000 + ExpMonth2 * 100 + 1);

def FirstFridayDOM = if Day1DOW < 6

then 6 - Day1DOW

else if Day1DOW == 6

then 7

else 6;

def ExpDOM = FirstFridayDOM + 14;

def N3rdF = if IsNaN(close) then Double.NaN else DaysTillDate(ExpYear * 10000 + ExpMonth2 * 100 + ExpDOM);

def "exiprationdate" = (ExpYear * 10000 + ExpMonth2 * 100 + ExpDOM);

def expirationdate = "exiprationdate";

##Defining Front month

def call = close(getATMOption(GetUnderlyingSymbol(), expirationdate + 1, OptionClass.CALL));

def put = close(getATMOption(GetUnderlyingSymbol(), expirationdate + 1, OptionClass.PUT));

rec closeSymbolWithOutNaN = CompoundValue(1, if IsNaN(call) then closeSymbolWithOutNaN[1] else call, call);

rec closeSymbolWithOutNaN1 = CompoundValue(1, if IsNaN(put) then closeSymbolWithOutNaN1[1] else put, put);

def "Put + Call" = closeSymbolWithOutNaN + (closeSymbolWithOutNaN1 );

def moveup = "Put + Call" + close;

def movedown = close - "Put + Call";

def day = GetDay();

def lastDay = GetLastDay();

def isToday = If(day == lastDay, 1, 0);

def show_Plot = If(showonlytoday and isToday, 1, If(!showonlytoday, 1, 0));

def Last_Close = if show_Plot and !IsNaN(close(period = aggregationPeriod)[-1])

then price else Double.NaN;

rec lastprice = CompoundValue(1, if IsNaN(close) then lastprice[1] else close, close);

def a = if HasEarnings() then GetYYYYMMDD() else Double.NaN;

def b = if GetYYYYMMDD() == a then lastprice else Double.NaN;

def d = if onExpansion then b else Double.NaN;

#making an earnings target

plot Bullseye = b;

Bullseye.HideTitle();

Bullseye.HideBubble();

Bullseye.SetPaintingStrategy(PaintingStrategy.POINTS);

Bullseye.AssignValueColor(Color.RED);

plot WhiteBullseye = b;

WhiteBullseye.HideTitle();

WhiteBullseye.HideBubble();

WhiteBullseye.SetPaintingStrategy(PaintingStrategy.POINTS);

WhiteBullseye.AssignValueColor(Color.WHITE);

WhiteBullseye.SetLineWeight(5);

rec moveonup = CompoundValue(1, if IsNaN(moveup) then moveonup[1] else moveup, moveup);

plot "Front Month Range Up" = if onExpansion then moveonup else Double.NaN;

"Front Month Range Up".SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

"Front Month Range Up".AssignValueColor(Color.WHITE);

"Front Month Range Up".HideTitle();

rec moveondown = CompoundValue(1, if IsNaN(movedown) then moveondown[1] else movedown, movedown);

plot "Front Month Range Down" = if onExpansion then moveondown else Double.NaN;

"Front Month Range Down" .SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

"Front Month Range Down" .AssignValueColor(Color.WHITE);

"Front Month Range Down" .HideTitle();

def hasearnings = if HasEarnings() then GetYYYYMMDD() else Double.NaN;

plot "Front Month Range Up Dot" = if GetYYYYMMDD() == hasearnings then "Front Month Range Up" else Double.NaN;

"Front Month Range Up Dot".SetPaintingStrategy(PaintingStrategy.POINTS);

"Front Month Range Up Dot" .AssignValueColor(Color.WHITE);

"Front Month Range Up Dot".SetLineWeight(4);

"Front Month Range Up Dot".HideTitle();

plot "Front Month Range down Dot" = if GetYYYYMMDD() == hasearnings then "Front Month Range Down" else Double.NaN;

"Front Month Range down Dot" .SetPaintingStrategy(PaintingStrategy.POINTS);

"Front Month Range down Dot" .AssignValueColor(Color.WHITE);

"Front Month Range down Dot" .SetLineWeight(4);

"Front Month Range down Dot" .HideTitle();

##next month

def NextCallOption = close( getNextExpirationOption((getATMOption(GetUnderlyingSymbol(), expirationdate + 1, OptionClass.CALL))));

rec nextmonthcalloption = CompoundValue(1, if IsNaN(NextCallOption) then nextmonthcalloption[1] else NextCallOption, NextCallOption);

def NextPutOption = close(getNextExpirationOption((getATMOption(GetUnderlyingSymbol(), expirationdate + 1, OptionClass.PUT))));

rec nextmonthputoption = CompoundValue(1, if IsNaN(NextPutOption) then nextmonthputoption[1] else NextPutOption, NextPutOption);

def nextstraddleprice = nextmonthcalloption + nextmonthputoption ;

def volcrush = (put + call) - nextstraddleprice;

def nextstraddlerangeup = price + nextstraddleprice;

def nextstraddlerangedown = price - nextstraddleprice;

rec nextmoveondown = CompoundValue(1, if IsNaN(nextstraddlerangedown) then nextmoveondown[1] else nextstraddlerangedown, nextstraddlerangedown);

plot "Next Month Straddle Down" = if onExpansion then nextmoveondown else Double.NaN;

"Next Month Straddle Down" .SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

"Next Month Straddle Down" .AssignValueColor(Color.CYAN);

"Next Month Straddle Down" .HideTitle();

rec nextmoveonUp = CompoundValue(1, if IsNaN(nextstraddlerangeup) then nextmoveonUp[1] else nextstraddlerangeup, nextstraddlerangeup);

plot "Next Month Straddle Up" = if onExpansion then nextmoveonUp else Double.NaN;

"Next Month Straddle Up" .SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

"Next Month Straddle Up".AssignValueColor(Color.CYAN);

"Next Month Straddle Up".HideTitle();

#chartlabels

AddLabel(yes, Concat(Concat(Concat("Front Month Straddle: ", (getATMOption(GetUnderlyingSymbol(), expirationdate + 1, OptionClass.CALL))), " / "), (getATMOption(GetUnderlyingSymbol(), expirationdate + 1, OptionClass.PUT))), (Color.WHITE));

AddLabel(yes, Concat("Front Straddle Price: ", "Put + Call") , (Color.WHITE));

AddLabel(yes, Concat(Concat(Concat("Next Month Straddle: ", getNextExpirationOption((getATMOption(GetUnderlyingSymbol(), expirationdate + 1, OptionClass.CALL)))), " / "), getNextExpirationOption((getATMOption(GetUnderlyingSymbol(), expirationdate + 1, OptionClass.PUT)))), (Color.CYAN));

AddLabel(yes, Concat("Next Month Straddle Price: ", nextstraddleprice) , (Color.CYAN));

#hint: <b>Dalke's Earnings Indicator</b>\n\n This study calls the ATM Options for the regular front month and next month's option chain. The straddle is priced and overlayed on the chart to show option's short straddle pricing as a move. The next month's short straddle is priced as well.

Shareable Link

https://tos.mx/fYx7yxF

Video Tutorial

 
Last edited by a moderator:
MBF

MBF

Active member
2019 Donor
how does it work?
Put it on the daily chart. You will see a dot with two lines, one on the top, dot in the middle and one on the bottom. Those are your targets depending on how the market feels about earnings. They will migrate to one or the other. you can mark them off on the daily so you can see them on lower time frames.
Sometimes the lines are really high or low so you may need to zoom out or scroll the right side price column to see them, if you place the indicator on the chart and dont see the lines and just see a dot, that is why.
 
S

Simteaz

New member
2019 Donor
Put it on the daily chart. You will see a dot with two lines, one on the top, dot in the middle and one on the bottom. Those are your targets depending on how the market feels about earnings. They will migrate to one or the other. you can mark them off on the daily so you can see them on lower time frames.
Sometimes the lines are really high or low so you may need to zoom out or scroll the right side price column to see them, if you place the indicator on the chart and dont see the lines and just see a dot, that is why.

Thanks. Does it tell if earning beat or drop prior to the announcement? I will play with it tonight.
 
MBF

MBF

Active member
2019 Donor
Thanks. Does it tell if earning beat or drop prior to the announcement? I will play with it tonight.
No. LOL! That would be fabulous.
It tells you the expected move after earnings. Be very careful because many stocks beat earnings and still tank and many do not beat earnings and rise anyway.
Mark out the lines, wait for earnings, wait for the direction and aim for the line the players have decided to go. Take AMZN today, missed earnings, the stock tanked AH, so I would think tomorrow it will follow suit. You can get an idea of how the stock reacts to earnings by looking at the earnings history and what happens when a certain stock misses or hits.
I wouldn't play until I can get in after the morning bell somewhere AND other traders have agreed to punish said earnings miss. I still wouldn't play that stock anyway, except paper.
 
Last edited:
S

Simteaz

New member
2019 Donor
gotcha, thanks a lot. just tried but i dont see anything. Is it applicable during market hours?
 
MBF

MBF

Active member
2019 Donor
gotcha, thanks a lot. just tried but i dont see anything. Is it applicable during market hours?
Has to be on a daily. Find the line above the dot and the line below the dot and mark those out. You probably wont see them on a lower TF but once you know the direction and note the daily candles day by day (I intraday and scalp) you should at least have your direction.
You will at least know the direction and not to trade against it and use pullbacks for entries.
 
MBF

MBF

Active member
2019 Donor
@Simteaz You can do it now. The stock has to have earnings coming up though.
 
MBF

MBF

Active member
2019 Donor
@Simteaz I see the problem, if you dont see the lines tick onto another timeframe chart and then back to the daily. Not sure why it sticks like that but that might be what youre talking about.
 
MBF

MBF

Active member
2019 Donor
No. LOL! That would be fabulous.
It tells you the expected move after earnings. Be very careful because many stocks beat earnings and still tank and many do not beat earnings and rise anyway.
Mark out the lines, wait for earnings, wait for the direction and aim for the line the players have decided to go. Take AMZN today, missed earnings, the stock tanked AH, so I would think tomorrow it will follow suit. You can get an idea of how the stock reacts to earnings by looking at the earnings history and what happens when a certain stock misses or hits.
I wouldn't play until I can get in after the morning bell somewhere AND other traders have agreed to punish said earnings miss. I still wouldn't play that stock anyway, except paper.
Now that was a fine example of how a stock missed earnings and rose anyway. This stock is set apart from most and looking at it in a market psychology view, this stock tanked pretty good AH but in premarket people were grabbing for it. It's a great stock and people saw an opportunity to buy it cheaply. Just goes to show ya. I'm not that great on reading market psychology but thats my take on it.
 
S

San

Member
2019 Donor
@MBF, I have verified couple of earning call stock and its seems to be working. Example GPN, ABMD
 
MBF

MBF

Active member
2019 Donor
@MBF, I have verified couple of earning call stock and its seems to be working. Example GPN, ABMD
I got it from Kaufman so It should defo work. So far so good on all the tickers Ive marked off.
 
R

RoughTrade

New member
@MBF THANK YOU FOR POSTING THIS !!
I could not get getATMOption to work for like weeks and googled everything, your code actually worked.
The date it wants is expiration Saturday.
Lifesaver.
 
MBF

MBF

Active member
2019 Donor
@MBF THANK YOU FOR POSTING THIS !!
I could not get getATMOption to work for like weeks and googled everything, your code actually worked.
The date it wants is expiration Saturday.
Lifesaver.
I’m glad! Please explain though. What do you mean you couldn’t get ATM Options?
 
MBF

MBF

Active member
2019 Donor
@ext99k

Code:
The link is broken, weird and I couldn't share the link but .... here is the code. Read the fine print

#Earnings Expectations

input price = close;

input aggregationPeriod = AggregationPeriod.DAY;

def onExpansion = if IsNaN(close) then yes else no;

#third friday calc

def series = 1;

Assert(series > 0, "'series' must be positive: " + series);

def showonlytoday = yes;

def CurrentYear = GetYear();

def CurrentMonth = GetMonth();

def CurrentDOM = GetDayOfMonth(GetYYYYMMDD());

def Day1DOW1 = GetDayOfWeek(CurrentYear * 10000 + CurrentMonth * 100 + 1);

def FirstFridayDOM1 = if Day1DOW1 < 6

    then 6 - Day1DOW1

    else if Day1DOW1 == 6

        then 7

        else 6;

def RollDOM = FirstFridayDOM1 + 14;

def ExpMonth1 = if RollDOM > CurrentDOM

    then CurrentMonth + series - 1

    else CurrentMonth + series;

def ExpMonth2 = if ExpMonth1 > 12

    then ExpMonth1 - 12

    else ExpMonth1;

def ExpYear = if ExpMonth1 > 12

    then CurrentYear + 1

    else CurrentYear;

def Day1DOW = GetDayOfWeek(ExpYear * 10000 + ExpMonth2 * 100 + 1);

def FirstFridayDOM = if Day1DOW < 6

    then 6 - Day1DOW

    else if Day1DOW == 6

        then 7

        else 6;

def ExpDOM = FirstFridayDOM + 14;

def N3rdF = if IsNaN(close) then Double.NaN else DaysTillDate(ExpYear * 10000 + ExpMonth2 * 100 + ExpDOM);

def "exiprationdate" = (ExpYear * 10000 + ExpMonth2 * 100 + ExpDOM);

def expirationdate = "exiprationdate";

##Defining Front month

def call =  close(getATMOption(GetUnderlyingSymbol(), expirationdate + 1, OptionClass.CALL));

def put =  close(getATMOption(GetUnderlyingSymbol(), expirationdate + 1, OptionClass.PUT));

rec closeSymbolWithOutNaN = CompoundValue(1, if IsNaN(call) then closeSymbolWithOutNaN[1] else call, call);

rec closeSymbolWithOutNaN1 = CompoundValue(1, if IsNaN(put) then closeSymbolWithOutNaN1[1] else put, put);

def "Put + Call" = closeSymbolWithOutNaN + (closeSymbolWithOutNaN1 );

def moveup = "Put + Call" + close;

def movedown = close - "Put + Call";

def day = GetDay();

def lastDay = GetLastDay();

def isToday = If(day == lastDay, 1, 0);

def show_Plot = If(showonlytoday and isToday, 1, If(!showonlytoday, 1, 0));

def Last_Close = if show_Plot and !IsNaN(close(period = aggregationPeriod)[-1])

then price else Double.NaN;

rec lastprice = CompoundValue(1, if IsNaN(close) then lastprice[1] else close, close);

def a = if HasEarnings() then GetYYYYMMDD() else Double.NaN;

def b = if GetYYYYMMDD() == a then lastprice else Double.NaN;

def d = if onExpansion then b else Double.NaN;

#making an earnings target

plot Bullseye = b;

Bullseye.HideTitle();

Bullseye.HideBubble();

Bullseye.SetPaintingStrategy(PaintingStrategy.POINTS);

Bullseye.AssignValueColor(Color.RED);

plot WhiteBullseye = b;

WhiteBullseye.HideTitle();

WhiteBullseye.HideBubble();

WhiteBullseye.SetPaintingStrategy(PaintingStrategy.POINTS);

WhiteBullseye.AssignValueColor(Color.WHITE);

WhiteBullseye.SetLineWeight(5);

rec moveonup = CompoundValue(1, if IsNaN(moveup) then moveonup[1] else moveup, moveup);

plot "Front Month Range Up" = if onExpansion then moveonup else Double.NaN;

"Front Month Range Up".SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

"Front Month Range Up".AssignValueColor(Color.WHITE);

"Front Month Range Up".HideTitle();

rec moveondown = CompoundValue(1, if IsNaN(movedown) then moveondown[1] else movedown, movedown);

plot "Front Month Range Down" =  if onExpansion then moveondown else Double.NaN;

"Front Month Range Down" .SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

"Front Month Range Down" .AssignValueColor(Color.WHITE);

"Front Month Range Down" .HideTitle();

def hasearnings = if HasEarnings() then GetYYYYMMDD() else Double.NaN;

plot "Front Month Range Up Dot" = if GetYYYYMMDD() == hasearnings then "Front Month Range Up"  else Double.NaN;

"Front Month Range Up Dot".SetPaintingStrategy(PaintingStrategy.POINTS);

"Front Month Range Up Dot" .AssignValueColor(Color.WHITE);

"Front Month Range Up Dot".SetLineWeight(4);

"Front Month Range Up Dot".HideTitle();

plot "Front Month Range down Dot" = if GetYYYYMMDD() == hasearnings then "Front Month Range Down" else Double.NaN;

"Front Month Range down Dot" .SetPaintingStrategy(PaintingStrategy.POINTS);

"Front Month Range down Dot" .AssignValueColor(Color.WHITE);

"Front Month Range down Dot" .SetLineWeight(4);

"Front Month Range down Dot" .HideTitle();

##next month

def NextCallOption = close( getNextExpirationOption((getATMOption(GetUnderlyingSymbol(), expirationdate + 1, OptionClass.CALL))));

rec nextmonthcalloption = CompoundValue(1, if IsNaN(NextCallOption) then nextmonthcalloption[1] else NextCallOption, NextCallOption);

def NextPutOption = close(getNextExpirationOption((getATMOption(GetUnderlyingSymbol(), expirationdate + 1, OptionClass.PUT))));

rec nextmonthputoption = CompoundValue(1, if IsNaN(NextPutOption) then nextmonthputoption[1] else NextPutOption, NextPutOption);

def nextstraddleprice = nextmonthcalloption + nextmonthputoption ;

def volcrush = (put + call) - nextstraddleprice;

def nextstraddlerangeup = price + nextstraddleprice;

def nextstraddlerangedown = price - nextstraddleprice;

rec nextmoveondown = CompoundValue(1, if IsNaN(nextstraddlerangedown) then nextmoveondown[1] else nextstraddlerangedown, nextstraddlerangedown);

plot "Next Month Straddle Down" =  if onExpansion then nextmoveondown else Double.NaN;

"Next Month Straddle Down" .SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

"Next Month Straddle Down" .AssignValueColor(Color.CYAN);

"Next Month Straddle Down" .HideTitle();

rec nextmoveonUp = CompoundValue(1, if IsNaN(nextstraddlerangeup) then nextmoveonUp[1] else nextstraddlerangeup, nextstraddlerangeup);

plot "Next Month Straddle Up" =  if onExpansion then nextmoveonUp else Double.NaN;

"Next Month Straddle Up" .SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

"Next Month Straddle Up".AssignValueColor(Color.CYAN);

"Next Month Straddle Up".HideTitle();

#chartlabels

AddLabel(yes, Concat(Concat(Concat("Front Month Straddle: ", (getATMOption(GetUnderlyingSymbol(), expirationdate + 1, OptionClass.CALL))), " / "), (getATMOption(GetUnderlyingSymbol(), expirationdate + 1, OptionClass.PUT))), (Color.WHITE));

AddLabel(yes, Concat("Front Straddle Price: ", "Put + Call") , (Color.WHITE));

AddLabel(yes, Concat(Concat(Concat("Next Month Straddle: ", getNextExpirationOption((getATMOption(GetUnderlyingSymbol(), expirationdate + 1, OptionClass.CALL)))), " / "), getNextExpirationOption((getATMOption(GetUnderlyingSymbol(), expirationdate + 1, OptionClass.PUT)))), (Color.CYAN));

AddLabel(yes, Concat("Next Month Straddle Price: ", nextstraddleprice) , (Color.CYAN));

#hint: <b>Dalke's Earnings Indicator</b>\n\n This study calls the ATM Options for the regular front month and next month's option chain. The straddle is priced and overlayed on the chart to show option's short straddle pricing as a move.  The next month's short straddle is priced as well.
 
Last edited:
E

ext99k

Member
@MBF thanks for your help!

Would appreciate it if someone can please define what "Front month" is, is that just the current month?

Any chance someone can please update the code to include more future month straddles? Would be useful as our expected price targets are over at least a few upcoming months, then we can also check the straddle expected moves against the probability cone to see if there's possible "discounts" in options, that are within our time horizon's price target

Also, Is it possible for someone to please update the code to include in the labels the % expected moves based on the straddle prices? that would make life easier when comparing stocks...

Think those two improvements will make this a lot more powerful. Wish I could update the code myself but unfortunately, I am not a programmer! Thanks!
 
Last edited:
E

ext99k

Member
Can someone please explain this script in more detail, like what exactly the Bulls Eye circles are for on the chart and how they're derived? Thanks.
 

Similar threads

Top