Actionable Daily Historical Volatility for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
This indicator uses historical volatility of the last 10 and 100 days. Not much information about it but I'm seeing some good cross up and cross down signals.

UfEXvIe.png


thinkScript Code

Code:
# Actionable Daily Historical Volatility
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/141g43Qm/

declare lower;

# Historical Volatility 10 day
def HV = stdev(log(close / close[1]), 10) * sqrt(365) * 100;
# Historical Volatility 100 day
def HV1 = stdev(log(close / close[1]), 100) * sqrt(365) * 100;

assignPriceColor(if HV>HV1 and HV[1]<HV1[1] then Color.Green else if HV<HV1 and HV[1]> HV1[1] then Color.Red else Color.White);

plot tenHV = HV;
plot HundredHV = HV1;

tenHV.SetDefaultColor(GetColor(1));
HundredHV.SetDefaultColor(GetColor(0));
 

diazlaz

Well-known member
2019 Donor
VIP
thanks Ben for sharing. Interesting concept; wouldn't it require a daily chart, since it's calc the HV and SQRT of the day, curious to see if the indicator was designed for daily time frame, rather than intraday timeframe?

I will stop check it to see if there is any variations.
 

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
@diazlaz Certainly, I think you should look at the daily chart first for this particular indicator. On $SPY it definitely spotted some nice bullish reversal signals.

BwKvYB0.png


It doesn't hurt to test on lower timeframes either :)
 

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
This was shared with our Warehouse members last week. It's now available to everyone.
 

Rsva0610

New member
Dear Ben, Can you please check for ROKU for Daily Timeframe the condition is failing, it is showing green candle when there is huge sell off.
 

horserider

Well-known member
VIP
Before anyone depends on this indicator make sure you read about HV. My understanding is it shows historical volatility of a stock without regard to direction. So how does this indicator function to choose a direction ? Makes little sense to me. Maybe someone can explain.
 

markos

Well-known member
VIP
@horserider you are correct that historical volatility on its own does not function to choose direction.
In this case, the code seems to compare the 10 day to the 100 day, so in this case looking at whether something is above or below, higher or lower, may give some sort of signal. Utility is, of course, up to the person using the indicator.
 

jma

New member
Hi Ben,

Is it possible to change the script to plot the ratio of the six-day historical volatility reading to the 100-day historical volatility reading? This is one of the trading techniques discussed in Street Smarts by LBR (Chapter 20, Historical volatility meets Toby Crabel).

Thanks!
 

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
@jma A slight modification to the script will give you what you want:

Code:
def HV1 = stdev(log(close / close[1]), 6) * sqrt(365) * 100;
 

jma

New member
Hi Ben,

Thank you so much for such a quick response. Sorry I know little about Thinkscript so please excuse my ignorance. If you make this change, I assume it changes the 10-period historical volatility to 6-period historical volatility. I also assume you meant def HV instead of def HV1 since HV1 is the 100-period historical volatility.

My question is: How do you plot the ratio of a 6-period historical volatility to 100-period historical volatility?

Thanks again for your time!
 

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
@jma I'm slightly confused about your request. The current indicator plot the 10 and 100 days historical volatility values. Do you want to keep the 100-day and change 10-day to 6-day?
 

jma

New member
Sorry if I did not make my request clear. I do NOT want to plot either the 6-day or 100-day historical volatility. Rather I would like to just plot the ratio of the 6-day historical volatility to the 100-day historical volatility:

6-day historical volatility divided by 100-day historical volatility

Thanks!
 

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
@jma I see. Try this:

Code:
# Actionable Daily Historical Volatility
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/141g43Qm/

declare lower;

# Historical Volatility 6 day
def HV = stdev(log(close / close[1]), 6) * sqrt(365) * 100;
# Historical Volatility 100 day
def HV1 = stdev(log(close / close[1]), 100) * sqrt(365) * 100;

plot ratio = HV / HV1;
 

jma

New member
Good morning Ben,

Do you have a script to create a Momentum Pinball Indicator used by Linda Raschke? Specifically I would like to use the 1-period Rate of Change as the input value to plot a 3-period RSI? Normally RSI would use the CLOSE price in its calculation. Here I would like to use the 1-period Rate of Change as the input value instead of the CLOSE price. This is a Study on Study. Thinkorswim does not seem to have an easy way to do this without writing a custom script.

Thanks and have a wonderful day!
 

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