indicator · on price · open source

Volatility Stop

Deepwick · @deepwickv1Updated 2 Oct 2026▲ 0 users
Running…
Loading chart…

About

Volatility Stop is a self-correcting ATR trail: the stop ratchets in the direction of the trend and resets when the trend flips.

  • Acts as a regime marker — the line flipping below price = trend up, flipping above = trend down.
  • Tighter than Chandelier because it uses the ratchet rather than the raw rolling high.

Source code

//@version=5
indicator("Volatility Stop", overlay=true)
len = input.int(20, "ATR length", minval=1, maxval=200)
mult = input.float(2, "ATR multiplier", minval=0.5, maxval=10, step=0.1)
var float stop = na
atr = ta.atr(len)
prevStop = na(stop) ? close : stop
stop := close > prevStop ? math.max(prevStop - atr * mult, close - atr * mult) : math.min(prevStop + atr * mult, close + atr * mult)
p_Vol_Stop = plot(stop, "Vol Stop", color=color.orange, linewidth=2)
alertcondition(close > stop and close[1] <= stop[1], "Trend up", "Volatility Stop flipped to trend-up")
alertcondition(close < stop and close[1] >= stop[1], "Trend down", "Volatility Stop flipped to trend-down")

Comments

No comments yet.

Sign in to comment.