OPEN-SOURCE SCRIPT

ATR Stop Loss & Take Profit

How It Works:
Parameters :
ATR Period : The period for calculating ATR (default is 14).
Stop Loss Multiplier : The ATR multiplier for calculating the stop-loss (default is 1.5).
Take Profit Multiplier : The ATR multiplier for calculating the take-profit (default is 2.0).
ATR Calculation :
The built-in ta.atr() function is used to calculate the Average True Range.
Stop-Loss Levels :
For long positions: the current price minus the ATR value multiplied by the multiplier.
For short positions: the current price plus the ATR value multiplied by the multiplier.
Take-Profit Levels :
For long positions: the current price plus the ATR value multiplied by the multiplier.
For short positions: the current price minus the ATR value multiplied by the multiplier.
Visualization :
Green line — Stop-loss level for long positions.
Red line — Stop-loss level for short positions.
Teal line — Take-profit level for long positions.
Orange line — Take-profit level for short positions.
Text labels "Long SL", "Short SL", "Long TP", and "Short TP" are added for clarity.

Declinazione di responsabilità