Auto Volatility Standard Deviation Levels for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
This indicator will plot volatility based standard deviation levels for the S&P 500 (SPY) and some futures instruments such as /ES, /NQ, and /RTY.

How does this work?

The standard deviation levels are based on the previous day closing value of $SPY and $VIX. The indicator was ported to ThinkorSwim from TradingView.

Here is a brief note from the developer for anyone trading futures:

For NQ, I use VXN closing price and for ES or RTY, I use VIX closing price.

No need to modify the code or change any value if you're going to use this on SPY chart. You will have to edit the script a bit if you want to get the previous day value of VXN instead of VIX.

6ELozYL.png


Code:
# Volatility Based Standard Deviations
# Assembled by BenTen at UseThinkScript.com
# Converted from https://www.tradingview.com/script/vXGZ9DdQ-Volatility-based-Standarde-Deviation-and-Fib-Pivot-Points/

input aggregationPeriod = AggregationPeriod.DAY;
def SettlementPrice = close(period = aggregationPeriod)[1];
def VixClose = close("VIX", period = aggregationPeriod)[1];

def ZTable = 0.0625;
def SD = SettlementPrice * (VixClose / 100) * ZTable;

# Standard Deviation Calculation

plot usd1 = SettlementPrice + SD;
plot usd75 = SettlementPrice + (0.75 * SD);
plot usd5 = SettlementPrice + (0.5 * SD);
plot usd25 = SettlementPrice + (0.25 * SD);

plot dsd25 = SettlementPrice - (0.25 * SD);
plot dsd5 = SettlementPrice - (0.5 * SD);
plot dsd75 = SettlementPrice - (0.75 * SD);
plot dsd1 = SettlementPrice - SD;

usd1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
usd1.SetDefaultColor(Color.DOWNTICK);
usd75.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
usd75.SetDefaultColor(Color.DOWNTICK);
usd5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
usd5.SetDefaultColor(Color.DOWNTICK);
usd25.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
usd25.SetDefaultColor(Color.DOWNTICK);
dsd25.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
dsd25.SetDefaultColor(Color.UPTICK);
dsd5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
dsd5.SetDefaultColor(Color.UPTICK);
dsd75.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
dsd75.SetDefaultColor(Color.UPTICK);
dsd1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
dsd1.SetDefaultColor(Color.UPTICK);
 
Last edited by a moderator:

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

thanks Ben, so if i wanted to use this on AMZN, then i would replace the SPY to AMZN? or to any ticker i am looking at?
 
@gjervis Not necessarily. By default, it will pull data from the current ticker you're looking at. The only time you need to adjust the ticker symbol in the script is if you want to use VXN instead of VIX.
 
@TOSTrader I assume a better correlation. /NQ is the E-mini NASDAQ Futures, so it would work better if you use VXN (CBOE NASDAQ Volatility Index) with it. All up for interpretation, of course.
 
@TOSTrader I assume a better correlation. /NQ is the E-mini NASDAQ Futures, so it would work better if you use VXN (CBOE NASDAQ Volatility Index) with it. All up for interpretation, of course.
hi ben i looked at the video more than 4 times very interesting,what i get out this is he keeps talking about the settlement price very important..
but i dont see it in the script.so i get it from volume profile,but when looking at other tickers like aapl fb we can get the settlement price.. but can not get the Standard deviations...is there a way we can get that on volume profile? thanks
 
@whats up From the TradingView version, the settlement price is set to the closing price of VIX and SPY from the previous day.

I even talked to the original developer, and this is what he said:

You can enter SPY closing price and vix closing price at the end of the day. It will give standard deviation levels and Fib levels for next day.
Actually, in future, I'll change this indicator to take symbol price itself as well as vix price. But since I use different volatility prices for different assets, that's why I made it to enter manually. For example, for QQQ, you can use VXN closing price for better results.
 
Maybe it is my eyes, but the video shows different spacing between the SD lines. This study the lines are always equally spaced. Is something in the calculations different?

What is ZTable ? def ZTable = 0.0625; Any idea where this value comes from?

Why not plot the settlementprice line (even if it is just yesterday's close)as the video points to its importance?
 
Hi @horserider thanks for taking interest in this indicator SD lines on the video is diff bec i think he uses the .05and .07 levels Ben did the .25 .50 .75 and 1 which is fine but here is my question, what if we did the fb aapl settlement price on the volume profile 30min chart and then take the standard DV Channel on TOS measure the move? If you do spy on volume profile. it gives you same levels what ben posted.
 
An interesting find Ben, I like it.

Question: Isn't the price settlement calculated a bit different from closed? I would probably manually enter that.
 
@Nomak You're probably right about the settlement price vs. the closing price. If you choose to calculate the settlement price, then you would have to enter the value manually. I asked the developer from TradingView, and he said an alternative would be to use the closing price of both SPY and VIX, which you can automate.
 
@BenTen Is it possible to create a scanner for this study? Says secondary period not allowed. Looking for candle close to cross a selected settlement price on a 5 min candle.
 
@YAD I don't think so, as pointed out by ToS, they don't support "secondary aggregation period" in their scanner. However, since these levels are static, try setting the scanner's timeframe to daily (D) to see if you can bypass that error.
 
@BenTen I am actually helping someone with a slightly tweaked version of this indicator. What I know about settlement price on ES and NQ (I will say exclusively as I am unsure in regards to other assets) settlement price is the average in the range of a 30 second candle from 2:14:30pm- 2:15:00pm EST. I have yet to see 30second candles in TOS so assuming they do not exist, is it possible to create a ' period = "DAY" [1] for the specific 1min candle of 2:14:00pm- 2:15:00pm EST to serve as a close estimation? It would work like a "previous day close" line but just more accurate to what the system is supposed to be
 
@Nomak this actually does not do anything when referencing prior day close. That setting is only useful on larger time frames when looking at the "close" value posted for the candle, no impact on indicators. I am asking if it is possible to reference a prior day value that occurs at a specific time of day? I want to grab price at 4:14pm EST, and value at 4:15pm EST, then I will take an average of the two values to generate "settlement price" artificially so people do not have to enter it each time to utilize this style of indicator
 
Really great indicator for S & P futures traders. A bit confused because it seemed in the video he was referring to every three lines crossed as a standard deviation, but maybe I am mistaken--I thought each line was one deviation. Regardless, the price often bounces off or forcefully passes through these levels.
 
You guys are awesome...I have been calculating this manually for the past 7 months every night.I think my chart is now complete and ready to test my strategy live. Thank you usethinkscript..great, the best trading community out here.
 
Really great indicator for S & P futures traders. A bit confused because it seemed in the video he was referring to every three lines crossed as a standard deviation, but maybe I am mistaken--I thought each line was one deviation. Regardless, the price often bounces off or forcefully passes through these levels.
From my own personal experience with this,refer and do your best to understand the belle curve and from there you will understand the deviation levels...
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
397 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