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.

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:

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.

To get a better understanding of this indicator, I recommend watching the video below.

**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.

To get a better understanding of this indicator, I recommend watching the video below.

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: