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.
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。