RicardoSantos

[RS]Volatility Scalper V0

EXPERIMENTAL:
request for DCC
adapted from: http://jonathankinlay.com/index.php/2014/05/implementation-of-a-scalping-strategy/
Remove from Favorite Scripts Add to Favorite Scripts
//@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)
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out