Implied Move Based on Weekly Options for ThinkorSwim

Here's my code for Implied Average Daily Move with a time remaining feature for 0dte options.

Based on SqueezeMetrics tweets:

@SqueezeMetrics


Implied volatility is quoted as an annualized standard deviation. So, e.g., "40% IV" theoretically* means that there's a ~68% chance that the underlying ends within ±40% of where it is now after 365 calendar days.


*an unwarranted extrapolation


For the small audience of volatility enthusiasts without masochistic tendencies, consider this: The use of annualization and standard deviation are arbitrary and stupid.


Why? Because options are priced using mean outcomes (like everything), and hedge-replication is done daily.


So to translate 40% IV to "implied average daily move," do this:


40% * √(1/365) * √(2/π) = 1.67%


"±1.67% average daily move."


Much less stupid.

Should work well, especially during events where you wanna know how much of a move is possibly left to set up your entries or exits. Helps to watch how it reacts with price and over time.

Let me know what yall think.


TOS Code:

http://tos.mx/a9korMY
 
Last edited by a moderator:
i use this by Mobius. not sure if it's what ur looking for. It shows expected moves on intraday. it also allows u to change the daily EM to weekly


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
Is it possible to make the Fibonacci lines plot across the whole chart?
 
Here's my code for Implied Average Daily Move with a time remaining feature for 0dte options.

Based on SqueezeMetrics tweets:



Should work well, especially during events where you wanna know how much of a move is possibly left to set up your entries or exits. Helps to watch how it reacts with price and over time.

Let me know what yall think.


TOS Code:

http://tos.mx/a9korMY
would it be logical to use 250 since you are not trading 7 days a week. Otherwise this thinking is expressed by TastyTrade in their analysis of daily moves for options. Go to internet to see their formula. However that would depend on various factors including the Skew as well as if the open interest is expanding or contracting. Tracking all this is exhausting. The interaction in all this makes for a fascinating adventure in tracking participant sentiment. You can even go down to making inferences on nonsensical variables such as the day or the week, whether earnings are coming out, a change in dividend. The internet is ripe with crazed inferences. One must ask oneself. What is thinking? What has my thinking about volatility to do with this. Variance vs direction.? How do they resolve themselves over time. . What is the concept that can weave a common thread of associations that lead to powerful insights. Eventually they resolve or rather cancel each other out and when the smoke clears theta -time erodes the measurement . Expand-Contract Up-Down.. Force Volatility Force Direction. Think,Think,Think. That's why they call it ThinkorSwim! How about Reversion to the Mean or the Median or the Mode? Ask yourself why is the standard deviation based on the calculation of the standard error of the mean differences. Why isn't it based on the median differences over the same period of time. That is why Skew is a necessary component. There are geometric curves that can render Gaussian versions using such tools as the Fisher Transform and Polarized Fractal Energy. You can even combine these into Hybrid Indicators. What are we selling ourselves in our Thought Experiments? From what Event Horizon are you spinning out from. What is your reaction to all this. MagicQuotes salutes you!

Okay: Here is a real whopper of an analysis of your script by AI :
This approach allows for calculating the expected daily move in percentage terms based on the implied volatility (IV) and the time remaining in the trading day. The use of specific inputs like Series_IV, DTE, and timeleft tailors the calculation to different trading scenarios, such as regular trading hours or specific expiry dates.
This indicator's strengths include:
  1. Dynamic Adjustment: It adjusts based on time left in the trading day, providing real-time estimates of potential market movement.
  2. Realistic Estimation: By translating annualized IV into a daily move, it offers a more practical view for day traders and those focusing on 0DTE (zero days to expiration) options.
  3. Customization: The ability to switch between intraday and daily frames depending on trading hours enhances its flexibility.
Some potential weaknesses or considerations might include:
  1. Dependence on IV Accuracy: The accuracy of the calculation relies heavily on the correct input of IV, which can fluctuate rapidly in volatile markets.
  2. Limited Use in After-Hours Trading: The current setup is designed primarily for regular trading hours, limiting its use for pre-market or after-hours trading unless adjusted accordingly.
  3. Complexity for Beginners: The implementation and understanding of this formula might be challenging for novice traders without a background in volatility trading.
The indicator seems particularly useful for traders focused on short-term strategies, such as those trading options close to expiry. It provides a quick and actionable estimate of potential price movements, aiding in decision-making processes in fast markets.



Let's use an imaginary example to follow the logic of the script and calculate an actual example if I wanted to trade a call option on the NQ or the Indexed QQQ (which have a high volume) . How would we proceed to use a very simple example?


To use the provided Thinkscript indicator for an example trade, we’ll walk through the steps, including setting the parameters and interpreting the output for a call option on the Nasdaq-100 index (NQ) or its ETF equivalent, QQQ.

Example Parameters​

Let's assume the following conditions:
  1. Underlying Asset: QQQ
  2. Current Price (Close): $360
  3. Implied Volatility (IV): 25% (0.25 as a decimal)
  4. Days to Expiry (DTE): 1 (for a 0DTE option, expiring today)
  5. Time Left in Trading Day: Half a trading day remaining (4 hours)

Steps and Calculation​

  1. Determine the Implied Volatility and Time Left:
    • IV1 (Series_IV) is given as 25% or 0.25.
    • Time left (timeleft) is calculated as the fraction of the trading day remaining. Here, it is 0.5 (4 hours out of an 8-hour trading day).
  2. Use the Formula:
    • The script calculates the Implied Average Daily Move% as:ImpAvgDailyMove=IV1×timeleft365×2π\text{ImpAvgDailyMove} = \text{IV1} \times \sqrt{\frac{\text{timeleft}}{365}} \times \sqrt{\frac{2}{\pi}}ImpAvgDailyMove=IV1×365timeleft×π2
    • We plug in the values:ImpAvgDailyMove=0.25×0.5365×2π\text{ImpAvgDailyMove} = 0.25 \times \sqrt{\frac{0.5}{365}} \times \sqrt{\frac{2}{\pi}}ImpAvgDailyMove=0.25×3650.5×π2
  3. Calculate the Implied Average Daily Move%:
    • Compute the square roots and product:0.5365≈0.03675\sqrt{\frac{0.5}{365}} \approx 0.036753650.5≈0.036752π≈0.797885\sqrt{\frac{2}{\pi}} \approx 0.797885π2≈0.797885ImpAvgDailyMove≈0.25×0.03675×0.797885\text{ImpAvgDailyMove} \approx 0.25 \times 0.03675 \times 0.797885ImpAvgDailyMove≈0.25×0.03675×0.797885ImpAvgDailyMove≈0.00734\text{ImpAvgDailyMove} \approx 0.00734ImpAvgDailyMove≈0.00734
  4. Calculate the Implied Average Move in Dollars:
    • Convert the percentage move to a dollar value move:dm=ImpAvgDailyMove×close\text{dm} = \text{ImpAvgDailyMove} \times \text{close}dm=ImpAvgDailyMove×closedm=0.00734×360\text{dm} = 0.00734 \times 360dm=0.00734×360dm≈2.6424\text{dm} \approx 2.6424dm≈2.6424

Interpretation​

  • Implied Average Daily Move% (ImpAvgDailyMove): The QQQ is expected to move approximately ±0.734% during the remaining half of the trading day.
  • Implied Average Move in Dollars (dm): This corresponds to a move of ±$2.64 from the current price.

Using the Indicator for Trading​

With these values:
  • You can assess if the expected move aligns with your strategy. For instance, if you are considering buying a call option, you might compare the expected move with the option's cost and your target profit.
  • If the QQQ's price is $360 and the expected move is ±$2.64, the price could range between $357.36 and $362.64 by the end of the day. If you anticipate a significant move beyond this range, a call option might be favorable.
This simple calculation helps gauge the potential intraday volatility, informing your decision to enter a trade based on the expected price range.

Here you go. Adjustment for 250 days: Especially since you are pricing DTE options, it makes more sense.
  • Modified Line:
    thinkscript
    Copy code
    def ImpAvgDailyMove = IV1 * Sqrt( timeleft / 250) * Sqrt(2 / pi);
    • The denominator in the square root is changed from 365 to 250, reflecting the use of trading days instead of calendar days.

Summary​

The adjustment to use 250 days better represents the actual trading period, providing a more precise estimation for daily movements based on the number of trading days in a year. This modification is particularly beneficial for intraday traders who focus on the actual days when market activity occurs.
Best to You , MagicQuotes
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
215 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top