RicardoSantos

[RS]Volatility Scalper V0

EXPERIMENTAL:
request for DCC
adapted from: jonathankinlay.com/i...a-scalping-strategy/
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(title='[RS]Volatility Scalper V0', overlay=false)
//  ||  Request from:
//  ||      DCC
//  ||  Adapted from:
//  ||      http://jonathankinlay.com/index.php/2014/05/implementation-of-a-scalping-strategy/
//  ||  
upper_volume_threshold = input(title='upper_volume_threshold', type=float, defval=0.01)
lower_volume_threshold = input(title='lower_volume_threshold', type=float, defval=0.001)
SHOW_SIGNALS = input(title='Show Barcolor Signals?', type=bool, defval=true)
upside_volatility = change(close) > 0 ? tr + change(tr, 2)*0.5 : na
downside_volatility = change(close) < 0 ? tr + change(tr, 2)*0.5 : na

plot(title='Upside Volatility', series=upside_volatility, style=histogram, color=green, linewidth=2)
plot(title='Downside Volatility', series=downside_volatility, style=histogram, color=red, linewidth=2)
hline(title='Upper volume threshold', price=upper_volume_threshold, color=black)
hline(title='Lower volume threshold', price=lower_volume_threshold, color=black)

high_volume_buy_trigger = not SHOW_SIGNALS ? na : upside_volatility >= upper_volume_threshold
high_volume_sel_trigger = not SHOW_SIGNALS ? na : downside_volatility >= upper_volume_threshold
low_volume_buy_trigger = not SHOW_SIGNALS ? na : upside_volatility >= lower_volume_threshold
low_volume_sel_trigger = not SHOW_SIGNALS ? na : downside_volatility >= lower_volume_threshold

bar_color = high_volume_buy_trigger ? green : high_volume_sel_trigger ? maroon : low_volume_buy_trigger ? lime : low_volume_sel_trigger ? red : silver
barcolor(bar_color)