OPEN-SOURCE SCRIPT
Aggiornato ATR SL 10/10

This indicator draws an ATR-based trailing stop on the main chart and shows two compact labels:
• Stop line = Low − (ATR × Multiplier).
• “Today” label: the current bar’s stop price.
• “5-bar Max” label: the highest stop value over the last N bars (rolling window). Labels auto-separate slightly if they overlap so both remain readable.
ATR selection logic
• On confirmed bars (after close): uses today’s ATR.
• In real-time (bar not confirmed): uses max(today’s ATR, yesterday’s ATR) to avoid under-estimating volatility early in the session.
Inputs
• Length: ATR period.
• Smoothing: RMA/SMA/EMA/WMA for ATR.
• Multiplier: stop distance in ATR units.
• Long Base: price source for the long stop (usually Low).
• Show Price Line: toggle the pink stop line.
• Lookback: window for the rolling 5-bar maximum label.
Notes
• Overlay = true; the line scales with the price chart.
• Prices/labels use mintick formatting for clean alignment.
• Works on any timeframe; ATR is computed from the active chart’s bars with the above real-time safeguard.
• Stop line = Low − (ATR × Multiplier).
• “Today” label: the current bar’s stop price.
• “5-bar Max” label: the highest stop value over the last N bars (rolling window). Labels auto-separate slightly if they overlap so both remain readable.
ATR selection logic
• On confirmed bars (after close): uses today’s ATR.
• In real-time (bar not confirmed): uses max(today’s ATR, yesterday’s ATR) to avoid under-estimating volatility early in the session.
Inputs
• Length: ATR period.
• Smoothing: RMA/SMA/EMA/WMA for ATR.
• Multiplier: stop distance in ATR units.
• Long Base: price source for the long stop (usually Low).
• Show Price Line: toggle the pink stop line.
• Lookback: window for the rolling 5-bar maximum label.
Notes
• Overlay = true; the line scales with the price chart.
• Prices/labels use mintick formatting for clean alignment.
• Works on any timeframe; ATR is computed from the active chart’s bars with the above real-time safeguard.
Note di rilascio
This indicator draws an ATR-based trailing stop on the main chart and shows two compact labels:
• Stop line = Low − (ATR × Multiplier).
• “Today” label: the current bar’s stop price.
• “5-bar Max” label: the highest stop value over the last N bars (rolling window). Labels auto-separate slightly if they overlap so both remain readable.
ATR selection logic
• On confirmed bars (after close): uses today’s ATR.
• In real-time (bar not confirmed): uses max(today’s ATR, yesterday’s ATR) to avoid under-estimating volatility early in the session.
Inputs
• Length: ATR period.
• Smoothing: RMA/SMA/EMA/WMA for ATR.
• Multiplier: stop distance in ATR units.
• Long Base: price source for the long stop (usually Low).
• Show Price Line: toggle the pink stop line.
• Lookback: window for the rolling 5-bar maximum label.
Notes
• Overlay = true; the line scales with the price chart.
• Prices/labels use mintick formatting for clean alignment.
• Works on any timeframe; ATR is computed from the active chart’s bars with the above real-time safeguard.
Note di rilascio
This indicator draws an ATR-based trailing stop on the main chart and shows two compact labels:• Stop line = Low − (ATR × Multiplier).
• “Today” label: the current bar’s stop price.
• “5-bar Max” label: the highest stop value over the last N bars (rolling window). Labels auto-separate slightly if they overlap so both remain readable.
ATR selection logic
• On confirmed bars (after close): uses today’s ATR.
• In real-time (bar not confirmed): uses max(today’s ATR, yesterday’s ATR) to avoid under-estimating volatility early in the session.
Inputs
• Length: ATR period.
• Smoothing: RMA/SMA/EMA/WMA for ATR.
• Multiplier: stop distance in ATR units.
• Long Base: price source for the long stop (usually Low).
• Show Price Line: toggle the pink stop line.
• Lookback: window for the rolling 5-bar maximum label.
Notes
• Overlay = true; the line scales with the price chart.
• Prices/labels use mintick formatting for clean alignment.
• Works on any timeframe; ATR is computed from the active chart’s bars with the above real-time safeguard.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.