OPEN-SOURCE SCRIPT
Actualizado 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.
Notas de prensa
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.
Notas de prensa
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 de código abierto
Siguiendo fielmente el espíritu de TradingView, el creador de este script lo ha publicado en código abierto, permitiendo que otros traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la publicación de este código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.
Script de código abierto
Siguiendo fielmente el espíritu de TradingView, el creador de este script lo ha publicado en código abierto, permitiendo que otros traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la publicación de este código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.