RicardoSantos

[RS]MTF CATR Stop Hunt Levels V0

EXPERIMENTAL:
Adaptation from stop hunt levels:
Uses timeframe and atr to set ranges.
开源脚本

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

免责声明

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

想在图表上使用此脚本?
study(title='[RS]MTF CATR Stop Hunt Levels V0', overlay=true)
tf = input(title='Timeframe:', defval='D', type=string)
src = input(title='Source', type=source, defval=close)
multiplier = input(title='Range Multiplier:', type=float, defval=1, step=0.01)

catr(_m) => (cum(tr)/(n+1))*_m

d_open = security(tickerid, tf, round(src/catr(1))*catr(1))
d_high = security(tickerid, tf, round(1+src/catr(1))*catr(1))
d_low = security(tickerid, tf, round(src/catr(1)-1)*catr(1))

d_open_buy = d_open+catr(multiplier)
d_open_sel = d_open-catr(multiplier)
d_high_buy = d_high+catr(multiplier)
d_high_sel = d_high-catr(multiplier)
d_low_buy = d_low+catr(multiplier)
d_low_sel = d_low-catr(multiplier)

dob = plot(title='mh', series=d_open_buy, style=circles, color=lime)
dos = plot(title='ml', series=d_open_sel, style=circles, color=red)
dhb = plot(title='hh', series=d_high_buy, style=circles, color=lime)
dhs = plot(title='hl', series=d_high_sel, style=circles, color=red)
dlb = plot(title='lh', series=d_low_buy, style=circles, color=lime)
dls = plot(title='ll', series=d_low_sel, style=circles, color=red)

fill(title='mf', plot1=dob, plot2=dos, color=blue, transp=75)
fill(title='hf', plot1=dhb, plot2=dhs, color=blue, transp=75)
fill(title='lf', plot1=dlb, plot2=dls, color=blue, transp=75)

plot(title='m', series=d_open, style=circles, color=black)
plot(title='h', series=d_high, style=circles, color=black)
plot(title='l', series=d_low, style=circles, color=black)