ZenAndTheArtOfTrading

ATR Trailing Stop Loss Indicator

I rely on this script for both my live trading and my backtesting process. I couldn’t live without it. It’s extremely simple – all it does is calculate your trailing stop price.

How It Works
The first number in blue is the current ATR (pips). The second number in green is your trailing stop loss price for Long trades, and the third number in red is your trailing stop loss price for Short trades.

For short trades, the stop loss price is calculated by adding the current ATR value to the highest-high of the given lookback period.

For long trades, the stop loss price is calculated by subtracting the current ATR value from the lowest-low of the given lookback period.

Settings
ATR Length:
ATR period (how many candles to include in the calculation).

Use Structure?
If set to true, the script will use swing lows and highs in its calculation. If set to false, the script will ignore swing lows and highs and give you the distance of the ATR from the current candle close instead.

How Far To Look Back For High/Lows:
Candle lookback period for swing high/lows.

ATR X ?:
This controls your ATR multiplier. For example, if you want to use a 2x ATR stop, set this to 2.

Chart Companion:
Here is the chart companion script for this indicator:


Source Code:
Go to https://zenandtheartoftrading.com/indicators/atr-trailing-stop-indicator/ for the source code – it’s free!
Phát hành các Ghi chú:
-
- Updated script to remove deprecated "transp" parameters
- Tidied up settings interface a little more
- To use the chart version of this script, click here:
Phát hành các Ghi chú:
Updated to Pine Script v5

My Resources Hub: theartoftrading.com
FREE YouTube Lessons: rebrand.ly/zyt
FREE Pine Script Basics Course: rebrand.ly/zpsbc
Pine Script MASTERY Course: rebrand.ly/zpsmc
My Indicators & Strategies: rebrand.ly/zmisc
Mã được bảo vệ
Tập lệnh này được xuất bản mã nguồn đóng và bạn có thể sử dụng một cách tự do. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ. Bạn không thể xem hoặc sửa đổi mã nguồn.
Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?