OPEN-SOURCE SCRIPT
Zaktualizowano ATR Stop-Loss & Targets

ATR and Supertrend-based SL/TP & Trailing System
This indicator combines Average True Range (ATR) and Supertrend logic to help traders define precise stop-loss, first target, and trailing stop-loss (TSL) levels.
⚙️ Key Features:
📏 ATR-based Stop-Loss & Target Lines:
Uses ATR (default period: 5) based on the previous day's candle for more stable risk management.
Multiplier 1 = Stop Loss
Multiplier 2 = First Target
Uses ATR(10) with a multiplier of 2.1, based on HL2.
Supertrend can be toggled ON/OFF from the settings.
This indicator combines Average True Range (ATR) and Supertrend logic to help traders define precise stop-loss, first target, and trailing stop-loss (TSL) levels.
⚙️ Key Features:
📏 ATR-based Stop-Loss & Target Lines:
Uses ATR (default period: 5) based on the previous day's candle for more stable risk management.
- Traders can choose the price source: Close, Open, or enter a manual price.
- SL and first target are calculated using multipliers:
Multiplier 1 = Stop Loss
Multiplier 2 = First Target
- 📉 Supertrend for Trailing Stop:
- Built-in Supertrend logic for trailing stop-loss management.
Uses ATR(10) with a multiplier of 2.1, based on HL2.
Supertrend can be toggled ON/OFF from the settings.
Informacje o Wersji
Overview: This free indicator combines ATR-based Stop Loss and Targets with a Supertrend-based Trailing Stop Loss, giving traders an all-in-one system for defining their risk, entry size, and managing trailing exits automatically.It is designed to help traders quickly determine:
- Optimal Stop-Loss and Target levels based on volatility (ATR)
- Correct position size based on maximum loss they can afford
- Dynamic trailing stop-loss using a Supertrend
⚙️ How It Works:
1️⃣ ATR-Based Stop-Loss and Target Levels
- The indicator calculates ATR (Average True Range) with a default period of 5.
- You can choose if ATR is calculated based on the current candle or the previous candle.
- Two multipliers are applied:
- Multiplier 1: For Stop-Loss
- Multiplier 2: For First Target
Input Options Available:
- Price Source: Choose from Close, Open, or manually enter a custom price. Default value is Close
- ATR Source Candle: Select Current or Previous. Default is Previous candle
- ATR Period: Default is 5 (modifiable).
- Multipliers: Set your desired levels for Stop-Loss and Target individually.
✨ Visualization:
- Horizontal lines are drawn for both Stop-Loss and First Target levels.
- Color and style of the lines are customizable (solid, dashed, dotted).
- Labels at the end of each line show exact price values.
2️⃣ Maximum Loss Control (Position Size Calculation)
- You can input a Max Loss Amount (default: 10,000).
- The system automatically calculates:
- Risk per share = difference between entry price and stop-loss.
- Position Size = (Max Loss) ÷ (Risk per share).
- Actual Calculated Loss = (Position Size × Risk per share).
✨ Visualization:
- A floating label below the candles displays:
- Position Size (rounded to nearest whole number)
- Actual Calculated Loss (based on real size, not estimation)
- Toggle ON/OFF the label using settings.
3️⃣ Supertrend Trailing Stop-Loss
- Built-in Supertrend using:
ATR Period = 10
ATR Multiplier = 2.1
Source = HL2 (High + Low / 2)
- You can choose to:
Enable or disable Supertrend
Highlight background based on trend direction
Show Buy/Sell Signals
- Alerts are available when Supertrend switches direction.
✨ Visualization:
- Uptrend = Green Supertrend Line
- Downtrend = Orange Supertrend Line
- Optional: Highlight background colors depending on trend.
Informacje o Wersji
Overview: This free indicator combines ATR-based Stop Loss and Targets with a Supertrend-based Trailing Stop Loss, giving traders an all-in-one system for defining their risk, entry size, and managing trailing exits automatically.It is designed to help traders quickly determine:
- Optimal Stop-Loss and Target levels based on volatility (ATR)
- Correct position size based on maximum loss they can afford
- Dynamic trailing stop-loss using a Supertrend
⚙️ How It Works:
1️⃣ ATR-Based Stop-Loss and Target Levels
- The indicator calculates ATR (Average True Range) with a default period of 5.
- You can choose if ATR is calculated based on the current candle or the previous candle.
- Two multipliers are applied:
- Multiplier 1: For Stop-Loss
- Multiplier 2: For First Target
Input Options Available:
- Price Source: Choose from Close, Open, or manually enter a custom price. Default value is Close
- ATR Source Candle: Select Current or Previous. Default is Previous candle
- ATR Period: Default is 5 (modifiable).
- Multipliers: Set your desired levels for Stop-Loss and Target individually.
✨ Visualization:
- Horizontal lines are drawn for both Stop-Loss and First Target levels.
- Color and style of the lines are customizable (solid, dashed, dotted).
- Labels at the end of each line show exact price values.
2️⃣ Maximum Loss Control (Position Size Calculation)
- You can input a Max Loss Amount (default: 10,000).
- The system automatically calculates:
- Risk per share = difference between entry price and stop-loss.
- Position Size = (Max Loss) ÷ (Risk per share).
- Actual Calculated Loss = (Position Size × Risk per share).
✨ Visualization:
- A floating label below the candles displays:
- Position Size (rounded to nearest whole number)
- Actual Calculated Loss (based on real size, not estimation)
- Toggle ON/OFF the label using settings.
3️⃣ Supertrend Trailing Stop-Loss
- Built-in Supertrend using:
ATR Period = 10
ATR Multiplier = 2.1
Source = HL2 (High + Low / 2)
- You can choose to:
Enable or disable Supertrend
Highlight background based on trend direction
Show Buy/Sell Signals
- Alerts are available when Supertrend switches direction.
✨ Visualization:
- Uptrend = Green Supertrend Line
- Downtrend = Orange Supertrend Line
- Optional: Highlight background colors depending on trend.
Informacje o Wersji
Heading added for clear differenciation betweeen type of ATR used. you may set the maximum loss amount in indicator, which will show user the number for shares he/she can buy/sell within SL point defined/calculated
Skrypt open-source
W duchu TradingView twórca tego skryptu udostępnił go jako open-source, aby traderzy mogli analizować i weryfikować jego funkcjonalność. Brawo dla autora! Możesz korzystać z niego za darmo, ale pamiętaj, że ponowna publikacja kodu podlega naszym Zasadom Społeczności.
Wyłączenie odpowiedzialności
Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.
Skrypt open-source
W duchu TradingView twórca tego skryptu udostępnił go jako open-source, aby traderzy mogli analizować i weryfikować jego funkcjonalność. Brawo dla autora! Możesz korzystać z niego za darmo, ale pamiętaj, że ponowna publikacja kodu podlega naszym Zasadom Społeczności.
Wyłączenie odpowiedzialności
Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.