OPEN-SOURCE SCRIPT

Trailing Stop with 21 EMA and ATR

Trailing Stop with 21 EMA and ATR

This indicator helps traders to dynamically track their trailing stops based on market volatility, ensuring better risk management and optimized exit points.

This Pine Script indicator for TradingView calculates and plots trailing stops based on the 21-period Exponential Moving Average (EMA) and the Average True Range (ATR). The script uses an ATR multiplier to adjust the trailing stops dynamically.

Key Features:

Trailing Stops Calculation:

Long Trailing Stop: Calculated as EMA21 - (ATR * ATR Multiplier)

Short Trailing Stop: Calculated as EMA21 + (ATR * ATR Multiplier)

Customization Options:

Visibility: Toggle the visibility of long and short trailing stops.

Color: Customize the color of the trailing stops for both long and short positions.

Line Width: Adjust the width of the trailing stop lines.

Inputs:

EMA Length: Set the length for the Exponential Moving Average (default is 21).

ATR Length: Set the length for the Average True Range (default is 14).

ATR Multiplier: Set the multiplier for the ATR to adjust the trailing stop distance (default is 1.0).

คำจำกัดสิทธิ์ความรับผิดชอบ