[RS]MTF CATR Stop Hunt Levels V0

3160 0
Adaptation from stop hunt levels:
Uses timeframe and atr to set ranges.
Remove from Favorite Scripts Add to Favorite Scripts
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)
Home Stock Screener Forex Screener Crypto Screener Economic Calendar Shows How It Works Chart Features Pricing House Rules Moderators Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Help Center Refer a friend Feature Request Blog & News Twitter
Profile Profile Settings Account and Billing Refer a friend My Support Tickets Help Center Ideas Published Followers Following Private Messages Chat Sign Out