ATR Stop Loss levelsATR Dynamic Stop Loss
BASED ON ATR Srop-Loss by Captaincoinflip INDICATOR
This indicator plots two reference points per bar — one above and one below price — representing the zone where normal market noise can reach based on current volatility. Its purpose is to help you place stops that won't get hunted by natural price movement, only by moves with real directional conviction. Hope you find it helpful.
- How it works
The calculation is based on the ATR (Average True Range), developed by J. Welles Wilder in 1978. ATR measures the real average range of each bar including session gaps, making it a more accurate volatility reference than a simple high-low range.
The formula is straightforward:
Upper point = base price + (ATR × multiplier)
Lower point = base price − (ATR × multiplier)
The higher the volatility, the wider the points. The calmer the market, the tighter they sit.
- Settings
ATR Period — number of bars averaged to calculate the ATR. 14 is Wilder's standard. Lower values react faster to recent volatility changes; higher values give a more stable reading.
Multiplier — how many ATRs of distance are projected from the base price. A value of 1.5 means the points sit 1.5 times the ATR away from price. Adjust to your style: scalping (1.0–1.5), intraday (1.5–2.0), swing (2.0–3.0).
Base price source — the reference point from which the SL levels are measured:
High/Low: upper point from the bar's high, lower from the low. The most natural option for intraday trading.
HL2: average of high and low — more centered and stable.
HLC3: typical price (high + low + close) / 3. A classic technical analysis reference.
OHLC4: average of all four bar prices. The smoothest option.
Close: both points from the closing price.
Open: both points from the opening price. Useful for gap context.
ATR Smoothing — how the True Range is averaged:
No smoothing: raw True Range of each bar. Most reactive.
RMA (Wilder): the original method. Long memory, stable. Recommended.
SMA: simple average. Equal weight to all bars.
EMA: exponential. More reactive to recent volatility.
WMA: linearly weighted. More weight to recent bars.
Visible bars — how many recent bars display the points. Default is 5. The rest of the chart stays clean.
Color and size — full visual customization of the dots: Tiny, Small, Normal or Large.
- Technical note
When hiding and re-showing the indicator, or when changing timeframes, the points recalculate correctly. This is standard TradingView behavior when the chart reloads.
This script is open source and released to the public domain — use it, modify it, build on it, do whatever you want with it. And remember: you are the only one responsible for the results you get.
LOVE AND PROFITS
Pine Script®指标






















