RicardoSantos

[RS]MTF Volatility Stop V0

259 2 31
request for: jackmk
Remove from Favorite Scripts Add to Favorite Scripts
//@version=2
study(title='[RS]MTF Volatility Stop V0', shorttitle='mtfVS', overlay=true)
multiplier = input(title='True Range Multiplier', type=float, defval=1.618)
tf = input(title='Timeframe to pool ATR:', type=string, defval='D', confirm=false)
length = input(title='ATR Length', type=integer, defval=20, minval=1)
range = security(tickerid, tf, atr(length))

trend = na(trend[1]) ? +1 : close > vstop[1] ? +1 : close < vstop[1] ? -1 : trend[1]
max_close = change(trend) != 0 ? close : close >= max_close[1] ? close : max_close[1]
min_close = change(trend) != 0 ? close : close <= min_close[1] ? close : min_close[1]
vstop = na(vstop[1]) ? hl2 :
         change(trend) > 0 ? close - (multiplier * range) : 
         trend > 0 ? max(vstop[1], max_close - (multiplier * range)) :
         change(trend) < 0 ? close + (multiplier * range) : 
         trend < 0 ? min(vstop[1], min_close + (multiplier * range)) : 
         vstop[1]

plot(title='mtfVS', series=vstop, style=circles, color=close>=vstop?lime:red, transp=0, linewidth=2)
plot(title='mtfVS', series=vstop, style=line, color=black, transp=0, linewidth=1)
jackvmk
a year ago
thank you very much again.
Reply
GoldBowtie
a year ago
Great!
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
France
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 Account and Billing Sign Out