1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
16 lines of Pine Script v5 from lib/reversals/vstop/vstop.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.
vstop.pine
//@version=5
indicator("Volatility Stop", "VSTOP", overlay=true)
period = input.int(20, minval=1)
multiplier = input.float(2.0, minval=0.0)
atr = ta.atr(period)
var float stop = na
var bool rising = true
candidate = rising ? close - multiplier * atr : close + multiplier * atr
stop := rising ? math.max(nz(stop, candidate), candidate) : math.min(nz(stop, candidate), candidate)
if rising and close < stop
rising := false
stop := close + multiplier * atr
if not rising and close > stop
rising := true
stop := close - multiplier * atr
plot(stop, "Stop", color=rising ? color.green : color.red, linewidth=2)
Overview
Volatility Stop tracks price changes over a user-defined ATR period and multiplier, plotting a green line during uptrends and a red line during downtrends directly on the price chart. When the close price crosses the stop level, the indicator flips direction and adjusts the trailing stop.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
period
int
20
period
multiplier
float
2.0
multiplier
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
This indicator plots Donchian Channel boundary lines along with dynamic fan projections directly on the price chart. It calculates the highest high, lowest low, and median price over a customizable lookback period. Whenever price establishes a new channel high
Dynamic Linear Regression calculates and plots linear regression trendlines and standard deviation channels directly on the price chart over a user-selected time period. Traders can configure static channels locked at the end time, dynamic channels that contin
This indicator overlays trend-following Supertrend bands on the price chart using Average True Range calculations. It plots trailing stop lines, highlights active trend directions, and prints buy or sell shape labels when price closes across band thresholds. I
Moon Dev Lunar Sniper is a multi-indicator overlay that scores confluence across fast and slow EMAs, RSI, MACD, DMI, and BB width to fire signals only when score meets the minimum threshold. It plots buy and sell signals on the price chart, highlights cosmic b
This overlay indicator plots a SuperTrend line on the price chart using a fixed ATR length of 10 and a factor of 3. When the trend direction is up it draws a green line and a light green fill toward the candle midpoint; when down it draws a red line and a ligh
The Ultimate Channel calculates an ultra-smoothed centerline alongside upper and lower volatility bands directly on the main price chart. It processes true range values through an advanced infinite impulse response smoothing filter to establish dynamic channel