RicardoSantos

[RS]Volatility Scalper V0

EXPERIMENTAL:
request for DCC
adapted from: jonathankinlay.com/i...a-scalping-strategy/
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?
//@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)