OPEN-SOURCE SCRIPT
Cập nhật Stop Loss - structuur + ATR-buffer

This indicator helps you avoid getting stopped out by a few pips when price sweeps an obvious level. Instead of placing your stop exactly at the last swing low/high — where liquidity sits — it calculates a stop level with a volatility-based buffer:
Stop = last confirmed swing low/high ± (ATR × multiplier + extra pips)
The chart shows the swing level (dotted line), the buffered stop level for longs and shorts (solid lines), and a label with the exact stop price, buffer size, and distance in pips — use that distance for your position sizing.
Settings:
Swing sensitivity — how many candles left/right must confirm a swing. Higher = only major swings, lower = minor swings closer to price.
ATR period / multiplier — the buffer scales with volatility, so it automatically widens on volatile pairs and higher timeframes.
Extra pips — fixed margin for spread (stops are triggered on bid/ask, not the mid-price your chart shows).
Note: the default settings are a starting point, not a recommendation. Backtest on your own trades: measure how far wicks typically pierce your swing levels relative to ATR, and set the multiplier accordingly. A wider stop means a smaller position at the same risk percentage — never more risk. If the buffered stop breaks your minimum R:R, skip the trade instead of tightening the stop.
Stop = last confirmed swing low/high ± (ATR × multiplier + extra pips)
The chart shows the swing level (dotted line), the buffered stop level for longs and shorts (solid lines), and a label with the exact stop price, buffer size, and distance in pips — use that distance for your position sizing.
Settings:
Swing sensitivity — how many candles left/right must confirm a swing. Higher = only major swings, lower = minor swings closer to price.
ATR period / multiplier — the buffer scales with volatility, so it automatically widens on volatile pairs and higher timeframes.
Extra pips — fixed margin for spread (stops are triggered on bid/ask, not the mid-price your chart shows).
Note: the default settings are a starting point, not a recommendation. Backtest on your own trades: measure how far wicks typically pierce your swing levels relative to ATR, and set the multiplier accordingly. A wider stop means a smaller position at the same risk percentage — never more risk. If the buffered stop breaks your minimum R:R, skip the trade instead of tightening the stop.
Phát hành các Ghi chú
Stop Loss — Structure + ATR BufferThis indicator helps you avoid getting stopped out by a few pips when price sweeps an obvious level. Instead of placing your stop exactly at the swing low/high — where liquidity sits — it calculates a stop level with a volatility-based buffer:
Stop = swing low/high ± (ATR × multiplier + extra pips)
The chart shows the reference level (dotted line), the buffered stop for longs and shorts (solid lines), and a label with the exact stop price, buffer size, and distance in pips — use that distance for your position sizing.
Two detection modes
Direct (no delay): takes the lowest low / highest high of the last N candles, recalculated every bar. No confirmation lag — ideal when you place your order before price returns to your entry zone. With the "closed candles only" option enabled, a lookback of 1 gives you exactly the wick of the last closed candle.
Confirmed swing (pivot): only uses confirmed swing points, with separately adjustable left/right confirmation. More stable, but the level appears with a delay of [right confirmation] candles.
Three preset slots
Save up to three complete parameter sets (mode, lookback, ATR settings, extra pips) and give each slot your own name — for example one per market or timeframe. Set them up once, click "Save as default", and switch between them with a single dropdown click. A label on the chart always shows which preset is active, so you never trade with the wrong parameter set.
Note: the default values are a starting point, not a recommendation. Backtest on your own trades: measure how far wicks typically pierce your levels relative to ATR and set the multiplier accordingly. A wider stop means a smaller position at the same risk percentage — never more risk. If the buffered stop breaks your minimum R:R, skip the trade instead of tightening the stop.
The interface text is in Dutch. Key terms: Actief preset-slot = active preset slot, Detectiemodus = detection mode, Terugkijkperiode = lookback period, Bevestiging links/rechts = left/right confirmation, Enkel gesloten candles = closed candles only, Toon long-stop/short-stop = show long/short stop.
Phát hành các Ghi chú
Stop Loss — Structure + ATR Buffer
This indicator helps you avoid getting stopped out by a few pips when price sweeps an obvious level. Instead of placing your stop exactly at the swing low/high — where liquidity sits — it calculates a stop level with a volatility-based buffer:
Stop = swing low/high ± (ATR × multiplier + extra pips)
The chart shows the reference level (dotted line), the buffered stop for longs and shorts (solid lines), and a label with the exact stop price, buffer size, and distance in pips — use that distance for your position sizing.
Two detection modes
Direct (no delay): takes the lowest low / highest high of the last N candles, recalculated every bar. No confirmation lag — ideal when you place your order before price returns to your entry zone. With the "Closed candles only" option enabled, a lookback of 1 gives you exactly the wick of the last closed candle.
Confirmed swing (pivot): only uses confirmed swing points, with separately adjustable left/right confirmation. More stable, but the level only appears after the right-side confirmation candles have closed.
Three preset slots
Save up to three complete parameter sets (mode, lookback, ATR settings, extra pips) and give each slot your own name — for example one per market or timeframe. Set them up once, click "Save as default", and switch between them with a single dropdown click. A label on the chart always shows which preset is active, so you never trade with the wrong parameter set.
Note: the default values are a starting point, not a recommendation. Backtest on your own trades: measure how far wicks typically pierce your levels relative to ATR and set the multiplier accordingly. A wider stop means a smaller position at the same risk percentage — never more risk. If the buffered stop breaks your minimum R:R, skip the trade instead of tightening the stop.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.