OPEN-SOURCE SCRIPT

4C Options Expected Move (Weekly + 0DTE)

Updated
This indicator plots the calculated Expected Move for BOTH Weekly and Zero Dated Expiration (0DTE) Daily options, for a quick visual reference.

Please Note: This indicator is different from our original "4C Expected Move (Weekly Options)" indicator, as it now packages the ability to ALSO plot 0DTE options expected moves along with Weekly expected moves. Many other newer features have also been implemented.

Background Information
The Expected Move (EM) is the amount that a stock is predicted to increase or decrease from its current price, based on the current level of options pricing and implied volatility.
This range can be viewed as possible support and resistance, or, once price gets outside of the range, institutional hedging actions can accelerate the move in that direction.
It can be useful to know what the weekly EM range is for a stock to understand the probabilities of the overall distance, direction and volatility for the week.

About the Indicator
This indicator plots the calculated Expected Move for BOTH Weekly and Zero Dated Expiration (0DTE) options, for a quick visual reference.
For the weekly EM, the range is based on the Weekly close of the prior week.
For the Daily EM based on 0DTE options, the range is based on the Daily close of the prior day.
The indicator will automatically start a new weekly EM plot at the beginning of the week, and a new daily EM at the beginning of each day.
The EM values must be updated weekly and/or daily.

Features
  • Plots the EM for the week
  • Plots the EM for the day, for symbols that offer daily expiration options
  • Plots the 2 Standard Deviation EM for both the weekly and daily EM
  • Labels with calculated values are plotted near the levels for quick visual aid


Settings
  • Can toggle weekly EM on/off
  • Can toggle Daily EM on/off
  • Can toggle 2 Standard Deviation lines on/off
  • Can toggle labels for all EM on/off
  • Robust line settings
  • Can adjust label location left/right based on personal preference
  • Can enter symbol into settings as a reference
  • Handy instructions in the settings


How To Set Up The Indicator
To use this indicator you must have access to a broker with options data (not available on Tradingview).
Usually, you can look at the stock's option chain to find the weekly expected move.
You will have to do your own research to find where this information is displayed depending on your broker. You may also need to find the information elsewhere if your broker does not have this information.
You can also do your calculation of the EM using the following formula (please do your own research):
Expected Move = Option Price x Implied Volatility x Square Root of Time

See screenshot example below
This is the Thinkorswim platform's option chain, and the Implied Volatility % and the calculated EM are on the right side of the option chain.
The Expected Move is circled in blue. Use the +- number in parentheses, NOT the % value.
For the weekly EM, input the number that corresponds to the weekly option into the indicator. This must be done on a weekly basis, and It is typically best to use the EM for the next week expiration that is generated AFTER the Friday close and/or before the Monday open of the upcoming week.
For the daily EM, input the number that corresponds to the daily 0DTE option into the indicator. This must be done on a daily basis, and it is typically best to use the EM value for the 0DTE option that is generated the night before (after market close), or before the market opens for that 0DTE. .

snapshot

Release Notes
4/18/23 Added ability to change the Expected Move Label Color.
Release Notes
Small change to hide the indicator on Daily timeframes and above.
Release Notes
Update Description:
Issue Fixed: Vertical Lines on the First Opening Bar

In the previous version of this indicator, a bug caused the expected move lines to plot vertically on the first bar of the trading day. This issue occurred because the lines were initialized with both start (x1) and end (x2) coordinates set to the same bar_index at the market open. As a result, the lines appeared vertical for the duration of the first bar.

How the Update Fixes the Issue:

Delayed Line Creation: The updated code ensures that the lines are only created after the first bar of the day has fully formed. By checking if bar_index > 1 before initializing the lines, we ensure that the lines extend horizontally from the start.

Conditional Initialization: The lines are now conditionally initialized only when a new day begins (isNewDay). This prevents the premature creation of lines at the market open and ensures they are plotted correctly as horizontal lines.

Proper Line Extension: After the lines are created, the code sets the x2 coordinate to bar_index + 1, ensuring that the lines extend to the right immediately after creation, preventing any vertical lines from appearing.

Result: This update resolves the issue, ensuring that all expected move lines (including 0DTE and 2-sigma lines) are plotted as horizontal lines from the first completed bar of the day, eliminating any vertical line artifacts at the market open.
Release Notes
Fixed bug where the Prior Day Close was plotting the "D" close[2] when the Extended Hours Chart was turned on, instead of "D" close[1]
Release Notes
Fixed bug where trying to customize the Prior Daily Close color did not work.
Release Notes
Fixed bug where trying to customize the 0DTE expected move Colors did not work.
Release Notes
Fixed bug where weekly EM levels were being plotted vertically during the fist bar of the week (on any timeframe).
e.g. If the chart timeframe was the 60 minute chart, and less than 60 mins had elapsed at the beginning of the week, then the lines would be vertical. after the 1st 60minute bar had closed, the lines would go back to normal and horizontal.
Release Notes
Small label fix
0dte0dteoptionsautolevelsAverage True Range (ATR)expectedmoveoptionsPivot points and levelsSPX (S&P 500 Index)Weekly Chartsweeklyoptions

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer