OPEN-SOURCE SCRIPT
ATR Stop Loss Calculator v2 Trade4Green

ATR Stop Loss Calculator
The ATR Stop Loss Calculator is a risk management tool that helps traders determine precise stop loss levels based on the Average True Range (ATR), a widely used volatility indicator developed by J. Welles Wilder. Rather than placing stop losses at arbitrary levels, this indicator anchors them to actual market volatility, ensuring your stop is proportional to how much the market is currently moving.
How it works
The indicator calculates the ATR over a configurable lookback period (default 14 candles) for each of the last 5 closed candles. Each candle is assigned an ID, where ID 1 represents the most recently closed candle and ID 5 the candle closed five bars ago. The ATR value of each candle is multiplied by a configurable multiplier (default 2.5) to produce the stop loss distance. This multiplier controls how much breathing room you give the trade relative to current volatility.
Stop loss calculation
Once you enter your entry price and select Buy or Sell, the indicator automatically calculates your stop loss price:
Buy trade: Entry price minus (ATR × multiplier)
Sell trade: Entry price plus (ATR × multiplier)
You select which candle ID to base your stop loss on, allowing you to reference the volatility at the exact candle where your setup occurred. An optional extra candle ID input lets you monitor any candle further back, such as candle 25, for additional reference.
How to use it
Add the indicator to your chart
Set your preferred ATR period and multiplier in the settings
Enter your intended entry price and select Buy or Sell
Choose which candle ID corresponds to your trade setup
Read your stop loss price directly from the table in the top right corner
All colors in the table are fully customizable to match your chart style.
The ATR Stop Loss Calculator is a risk management tool that helps traders determine precise stop loss levels based on the Average True Range (ATR), a widely used volatility indicator developed by J. Welles Wilder. Rather than placing stop losses at arbitrary levels, this indicator anchors them to actual market volatility, ensuring your stop is proportional to how much the market is currently moving.
How it works
The indicator calculates the ATR over a configurable lookback period (default 14 candles) for each of the last 5 closed candles. Each candle is assigned an ID, where ID 1 represents the most recently closed candle and ID 5 the candle closed five bars ago. The ATR value of each candle is multiplied by a configurable multiplier (default 2.5) to produce the stop loss distance. This multiplier controls how much breathing room you give the trade relative to current volatility.
Stop loss calculation
Once you enter your entry price and select Buy or Sell, the indicator automatically calculates your stop loss price:
Buy trade: Entry price minus (ATR × multiplier)
Sell trade: Entry price plus (ATR × multiplier)
You select which candle ID to base your stop loss on, allowing you to reference the volatility at the exact candle where your setup occurred. An optional extra candle ID input lets you monitor any candle further back, such as candle 25, for additional reference.
How to use it
Add the indicator to your chart
Set your preferred ATR period and multiplier in the settings
Enter your intended entry price and select Buy or Sell
Choose which candle ID corresponds to your trade setup
Read your stop loss price directly from the table in the top right corner
All colors in the table are fully customizable to match your chart style.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.