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));
 

Attachments

  • UfEXvIe.png
    UfEXvIe.png
    90.7 KB · Views: 125

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

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.
 
@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 :)
 

Attachments

  • BwKvYB0.png
    BwKvYB0.png
    108.3 KB · Views: 117
This was shared with our Warehouse members last week. It's now available to everyone.
 
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.
 
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.
 
@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.
 
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!
 
@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;
 
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!
 
@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?
 
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!
 
@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;
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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