RicardoSantos

[RS]Volatility Stop V0

152 1 20
request for: jackvmk
Remove from Favorite Scripts Add to Favorite Scripts
//@version=2
study(title='[RS]Volatility Stop V0', shorttitle='VS', overlay=true)
multiplier = input(title='True Range Multiplier', type=float, defval=1.618)

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 * tr) : 
         trend > 0 ? max(vstop[1], max_close - (multiplier * tr)) :
         change(trend) < 0 ? close + (multiplier * tr) : 
         trend < 0 ? min(vstop[1], min_close + (multiplier * tr)) : 
         vstop[1]

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