RicardoSantos

[RS]Max Range Grid V0

2395浏览
226
Grid based on maximum range (largest candle) avaible on loaded data.
开源脚本

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

想在图表上使用此脚本?
//@version=2
study(title='[RS]Max Range Grid V0', shorttitle='MRG', overlay=true)
USE_ALT_TF = input(title='Use Alternative Timeframe?', type=bool, defval=false)
tf = input(title='Alternative Timeframe:', type=string, defval='D', confirm=false)

f_max_tr()=> _max_tr = na(_max_tr[1]) ? tr : tr > _max_tr[1] ? tr : _max_tr[1]
max_tr = USE_ALT_TF ? security(tickerid, tf, f_max_tr()) : f_max_tr()

r_center = round(close / max_tr) * max_tr

f_upper(_multiplier)=>r_center + max_tr * _multiplier
f_lower(_multiplier)=>r_center - max_tr * _multiplier

plot(title='ME', series=r_center, color=change(r_center) != 0 ? na : black, transp=0, linewidth=2)
plot(title='U01', series=f_upper(1), color=change(r_center) != 0 ? na : black, transp=0, linewidth=1)
plot(title='U02', series=f_upper(2), color=change(r_center) != 0 ? na : black, transp=0, linewidth=1)
plot(title='U03', series=f_upper(3), color=change(r_center) != 0 ? na : black, transp=0, linewidth=1)
plot(title='U04', series=f_upper(4), color=change(r_center) != 0 ? na : black, transp=0, linewidth=1)
plot(title='U05', series=f_upper(5), color=change(r_center) != 0 ? na : black, transp=0, linewidth=1)

plot(title='L01', series=f_lower(1), color=change(r_center) != 0 ? na : black, transp=0, linewidth=1)
plot(title='L02', series=f_lower(2), color=change(r_center) != 0 ? na : black, transp=0, linewidth=1)
plot(title='L03', series=f_lower(3), color=change(r_center) != 0 ? na : black, transp=0, linewidth=1)
plot(title='L04', series=f_lower(4), color=change(r_center) != 0 ? na : black, transp=0, linewidth=1)
plot(title='L05', series=f_lower(5), color=change(r_center) != 0 ? na : black, transp=0, linewidth=1)

评论