Labels for IV and Expected Moves for Options Traders

markos

markos

Well-known member
VIP
Todays Implied and Probable Moves by Mobius. Calculations are based on the nearest Series Implied Volatility.



thinkScript Code
Rich (BB code):
# Todays Implied and Probable Moves For Futures with Multiple Weekly Expirations
# Mobius
# V01.05.2016
# V02.08.01.2018 - Altered open to getTime() function
# Plots the Implied Move and Probable Move as upper and lower bands.
addLabel(1, "Implied and Probable Moves", color.white);

input showCloud = yes; #hint showCloud: clouds area between upper / lower Probable Move
input showLabel = yes; #hint showLabel: Displays Implied Volatility and Implied Move
input showBubbles = yes; #hint showBubbles: Turns bubbles on or off;
def c = close;
def x = barNumber();
def nan = double.nan;
def ts = TickSize();
def contChange = if HasContractChangeEvent()
                 then getYYYYMMDD()
                 else contChange[1];
def ChangeDay = getYYYYMMDD() == contChange;
AddLabel(ChangeDay, "Contract Change", color.red);
def RTH = getTime() >= RegularTradingStart(getYYYYMMDD()) and
          getTime() <= regularTradingEnd(getYYYYMMDD());
def sIV;
if !isNaN(seriesVolatility(series = 1))
    {
     sIV = seriesVolatility(series = 1);
    }
else if isNaN(seriesVolatility(series = 1))
    {
     sIV = seriesVolatility(series = 2);
    }
else
    {
     sIv = sIV[1];
    }
def o = if GetTime() crosses above RegularTradingStart(GetYYYYMMDD())
        then open
        else o[1];
def Day1DOW1 = getDayOfWeek(getYYYYMMDD());
def nDays = if Day1DOW1 < 3
    then 3 - Day1DOW1
    else if Day1DOW1 == 3
    then 1
    else if Day1DOW1 > 3
    then 6 - Day1DOW1
    else if Day1DOW1 == 6
        then 4
        else 3;
def ImpMove = Round(((((o * sIV * Sqrt(nDays)) / Sqrt(365)))/ nDays / ts), 0) * ts;
def oX = if GetTime() crosses above RegularTradingStart(GetYYYYMMDD())
         then x
         else nan;
plot upper = if x >= HighestAll(oX)
             then HighestAll(if IsNaN(c[-1])
                             then o + ImpMove
                             else nan)
             else nan;
     upper.SetStyle(Curve.Long_Dash);
     upper.SetLineWeight(3);
     upper.SetDefaultColor(Color.Green);
     upper.HideTitle();
AddChartBubble(showBubbles and x == HighestAll(x), upper, "ImpMove", color.green);
plot Upper2 = if x >= HighestAll(oX)
             then HighestAll(if IsNaN(c[-1])
                             then o + (ImpMove * .32)
                             else nan)
             else nan;
     upper2.SetStyle(Curve.Short_Dash);
     upper2.SetLineWeight(3);
     upper2.SetDefaultColor(Color.Dark_Green);
     upper2.HideTitle();
AddChartBubble(showBubbles and x == HighestAll(x), upper2, "ProbMove", color.dark_green);
plot lower = if x >= HighestAll(oX)
             then HighestAll(if IsNaN(c[-1])
                             then o - ImpMove
                             else nan)
             else nan;
     lower.SetStyle(curve.Long_Dash);
     lower.SetLineWeight(3);
     lower.SetDefaultColor(Color.Red);
     lower.HideTitle();
AddChartBubble(showBubbles and x == HighestAll(x), lower, "ImpMove", color.red, no);
plot lower2 = if x >= HighestAll(oX)
             then HighestAll(if IsNaN(c[-1])
                             then o - (ImpMove * .32)
                             else nan)
             else nan;
     lower2.SetStyle(curve.Short_Dash);
     lower2.SetLineWeight(3);
     lower2.SetDefaultColor(Color.Dark_Red);
     lower2.HideTitle();
AddChartBubble(showBubbles and x == HighestAll(x), lower2, "ProbMove", color.red, no);
addCloud(if showCloud then lower2 else nan, upper2, color.dark_gray, color.dark_gray);
addLabel(showLabel, "Series IV = " + Aspercent(sIV) +
          "  68% Prob. Implied Move Less Than = " + AsDollars(ImpMove), color.white);
# End Code Implied and Probable Moves
Shareable Link
http://tos.mx/LCaPVC or https://www-tx.mytrade.com/profile/Mobius/statuses/11159233
 
Last edited:
N

Nick

Member
VIP
Thanks for sharing. Can someone help to explain how this works and best timeframe to use. Thank you

 
Last edited:
BenTen

BenTen

Administrative
Staff
VIP
@Nick The labels that you see in the screenshot above is the indicator. It will display the same info regardless of which timeframes you’re on. As far as how to use such info produced by the indicator, here is a good start: https://www.tastytrade.com/tt/learn/expected-move

 
Last edited:
markos

markos

Well-known member
VIP
Label_IVPercentileTastyTrade
I came across this recently - No Date Given

Rich (BB code):
declare upper; 

input period = AggregationPeriod.DAY ; 

#hint period: time period to use for aggregating implied volatility. 

input length =252 ; 

#hint length: #bars to use in implied volatility calculation. 

def ivGapHi = if isnan(imp_volatility(period=period)) then 99999999999 else imp_volatility(period=period); 

def ivGapLo = if isnan(imp_volatility(period=period)) then -99999999999 else imp_volatility(period=period); 

def periodHigh = highest( ivGapLo,length=length); 

def periodLow = lowest( ivGapHi, length=length); 

def ivRange = periodHigh - periodLow ; 

def ivp = round( 100*(imp_volatility(period=period) - periodLow)/ivRange, 0); 

AddLabel(1, Concat("IV Rank%: ", ivp), color = CreateColor(255-(ivp*2.55),ivp*2.55,0));
 
Last edited by a moderator:
markos

markos

Well-known member
VIP
Implied Move for Different Series IV

Study plots the intraday implied volatility range with the mean as a user input of the previous close, todays open or the previous Friday. Fibonacci lines are also plotted for trading the range. The Fibonacci lines along with a cloud for the overall range can be turned on and off with user inputs.



Rich (BB code):
#- Mobius_  Implied Move For Different Series IV 
#- Mobius 
#- V01.03.2017 

input show_label = yes; 

input Series_IV = 1; #hint Series_IV: Series 1 is closest expirery.  

input DefTime = {"Today", default "Yesterday", "Friday"}; 

input Label_Color_Choice = {default "pink", "cyan", "orange", "gray", "yellow", "red", "green", "dark_gray", "light_yellow", "white"}; 

input Show_Cloud = yes; 

input Show_Fibs = yes; 

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

def o = open; 

def c = close; 

def bar = barNumber(); 

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_IV - 1 

    else CurrentMonth + series_IV; 

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(c)  

            then Double.NaN  

            else daysTillDate(ExpYear * 10000 + ExpMonth2 * 100 + ExpDOM); 

def CurrentDOW = GetDayOfWeek(GetYYYYMMDD()); 

def Fcbar = if CurrentDOW == 5 and SecondsTillTime(1600) == 0 

           then bar  

           else Fcbar[1]; 

def seriesIV = if isNaN(SeriesVolatility(series = Series_IV))  

               then seriesIV[1]  

               else SeriesVolatility(series = Series_IV); 

def t; 

def tBar; 

def nDays; 

switch (DefTime) 

{ 

case Today: 

    t = if SecondsFromTime(0930) == 0 

        then o 

        else t[1]; 

    tbar = if SecondsFromTime(0930) == 0 

           then bar 

           else double.nan; 

case Yesterday: 

    t = if secondsTillTime(1600) == 0 

        then c 

        else t[1]; 

   tbar = if secondsFromTime(1600) == 0 

          then bar 

          else double.nan; 

case Friday: 

    t = if BarNumber() == Fcbar  

        then c 

        else t[1]; 

    tbar = Fcbar; 

} 

if Series_IV == 1 and CurrentDOW == 1 

{ 

    nDays = 3; 

} 

else if Series_IV == 1 and CurrentDOW == 2 

{ 

    nDays = 2; 

} 

else if Series_IV == 1 and CurrentDOW == 3 

{ 

    nDays = 1; 

} 

else if Series_IV == 1 and CurrentDOW == 4 

{ 

    nDays = 2; 

} 

else if Series_IV == 1 and CurrentDOW == 5 

{ 

    nDays = 1; 

} 

else if Series_IV >= 2 

{ 

    nDays = N3rdF; 

} 

else 

{ 

    nDays = nDays[1]; 

} 

def ImpMove = Round(((t * seriesIV * Sqrt(nDays)) / Sqrt(365)) / TickSize(), 0) * TickSize(); 

plot mean = if bar >= HighestAll(tBar) 

            then HighestAll(if isNaN(close[-1]) 

                            then t 

                            else double.nan) 

            else double.nan; 

     mean.SetStyle(Curve.Long_Dash); 

     mean.SetLineWeight(2); 

     mean.SetDefaultColor(GetColor(Label_Color_Choice)); 

plot upper = if bar >= HighestAll(tBar) 

             then HighestAll(if isNaN(c[-1]) 

                             then t + ImpMove 

                             else double.nan) 

              else Double.NaN; 

     upper.SetDefaultColor(GetColor(Label_Color_Choice)); 

     upper.SetLineWeight(2); 

     upper.SetPaintingStrategy(PaintingStrategy.DASHES); 

plot lower = if bar >= HighestAll(tBar) 

             then HighestAll(if isNaN(c[-1]) 

                             then t - ImpMove 

                             else double.nan) 

             else Double.NaN; 

     lower.SetDefaultColor(GetColor(Label_Color_Choice)); 

     lower.SetLineWeight(2); 

     lower.SetPaintingStrategy(PaintingStrategy.DASHES); 

Addcloud(if Show_Cloud  

         then lower  

         else double.nan, upper, color.dark_gray, color.dark_gray); 

plot upper236 = if bar >= HighestAll(tBar) and Show_Fibs 

     then HighestAll(if isNaN(close[-1]) 

     then Round((((upper - mean) * .236) + mean) / TickSize(), 0) * TickSize() 

     else double.nan) 

     else double.nan; 

     upper236.SetStyle(Curve.Short_Dash); 

     upper236.SetDefaultColor(Color.dark_gray); 

plot upper382 = if bar >= HighestAll(tBar) and Show_Fibs 

     then HighestAll(if isNaN(close[-1]) 

     then Round((((upper - mean) * .382) + mean) / TickSize(), 0) * TickSize() 

     else double.nan) 

     else double.nan; 

     upper382.SetStyle(Curve.Short_Dash); 

     upper382.SetDefaultColor(Color.dark_gray); 

plot upper50 = if bar >= HighestAll(tBar) and Show_Fibs 

     then HighestAll(if isNaN(close[-1]) 

     then Round((((upper - mean) * .5) + mean) / TickSize(), 0) * TickSize() 

     else double.nan) 

     else double.nan; 

     upper50.SetStyle(Curve.Short_Dash); 

     upper50.SetDefaultColor(Color.dark_gray); 

plot upper618 = if bar >= HighestAll(tBar) and Show_Fibs 

     then HighestAll(if isNaN(close[-1]) 

     then Round((((upper - mean) * .618) + mean) / TickSize(), 0) * TickSize() 

     else double.nan) 

     else double.nan; 

     upper618.SetStyle(Curve.Short_Dash); 

     upper618.SetDefaultColor(Color.dark_gray); 

plot upper786 = if bar >= HighestAll(tBar) and Show_Fibs 

     then HighestAll(if isNaN(close[-1]) 

     then Round((((upper - mean) * .786) + mean) / TickSize(), 0) * TickSize() 

     else double.nan) 

     else double.nan; 

     upper786.SetStyle(Curve.Short_Dash); 

     upper786.SetDefaultColor(Color.dark_gray); 

plot lower236 = if bar >= HighestAll(tBar) and Show_Fibs 

     then HighestAll(if isNaN(close[-1]) 

     then Round((mean - (mean - lower) * .236) / TickSize(), 0) * TickSize() 

     else double.nan) 

     else double.nan; 

     lower236.SetStyle(Curve.Short_Dash); 

     lower236.SetDefaultColor(Color.dark_gray); 

plot lower382 = if bar >= HighestAll(tBar) and Show_Fibs 

     then HighestAll(if isNaN(close[-1]) 

     then Round((mean - (mean - lower) * .382) / TickSize(), 0) * TickSize() 

     else double.nan) 

     else double.nan; 

     lower382.SetStyle(Curve.Short_Dash); 

     lower382.SetDefaultColor(Color.dark_gray); 

plot lower50 = if bar >= HighestAll(tBar) and Show_Fibs 

     then HighestAll(if isNaN(close[-1]) 

     then Round((mean - (mean - lower) * .5) / TickSize(), 0) * TickSize() 

     else double.nan) 

     else double.nan; 

     lower50.SetStyle(Curve.Short_Dash); 

     lower50.SetDefaultColor(Color.dark_gray); 

plot lower618 = if bar >= HighestAll(tBar) and Show_Fibs 

     then HighestAll(if isNaN(close[-1]) 

     then Round((mean - (mean - lower) * .618) / TickSize(), 0) * TickSize() 

     else double.nan) 

     else double.nan; 

     lower618.SetStyle(Curve.Short_Dash); 

     lower618.SetDefaultColor(Color.dark_gray); 

plot lower786 = if bar >= HighestAll(tBar) and Show_Fibs 

     then HighestAll(if isNaN(close[-1]) 

     then Round((mean - (mean - lower) * .786) / TickSize(), 0) * TickSize() 

     else double.nan) 

     else double.nan; 

     lower786.SetStyle(Curve.Short_Dash); 

     lower786.SetDefaultColor(Color.dark_gray); 

AddLabel(show_label, "Series " + Series_IV + " IV = " + AsPercent(seriesIV) + 

                   "  " + nDays + " Day(s) Remaining. " + 

                   "  Implied Move = " + AsDollars(ImpMove) + 

                   "  Starting Value = " + AsDollars(t), GetColor(Label_Color_Choice)); 

# End Code Implied Moves From Series IV
Shareable link: http://tos.mx/nqv6y4

> Many more indicators are in the thinkScript lounge here.
 
Last edited:

Top