samuelhei

VOLATILITY COMPARISON METHODOLOGY

70
A simple method to compare the volatility of two securities.
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 a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
//@version=2
study("VOLATILITY COMPARASION", overlay=false)

comp1 = input('BTCUSD', type=symbol)
comp2 = input('IF1!', type=symbol)

input = security(comp1,period,close[1])

bars = input(100)
h = highest(input,bars)
l = lowest(input,bars)


dif = h/l
avgDif = (sma(dif,bars)-1)*100

plot(avgDif, title="VOL1", color=black)

input2 = security(comp2,period,close[1])


h2 = highest(input2,bars)
l2 = lowest(input2,bars)


dif2 = h2/l2
avgDif2 = (sma(dif2,bars)-1)*100

plot(avgDif2, title="VOL2", color=red)