OPEN-SOURCE SCRIPT
Cập nhật Sigmoid Transition Trailing Stop [LuxAlgo]

The Sigmoid Transition Trailing Stop indicator provides a dynamic risk management tool that utilizes a mathematical sigmoid function to smoothly adjust stop levels when price trends become overextended. Unlike traditional trailing stops that move linearly or remain static until a new high/low is formed, this script proactively "catches up" to price during periods of high momentum using a non-linear transition.
🔶 USAGE
The indicator functions as a trend-following stop-loss or take-profit level. When the price crosses the trailing stop, the trend direction flips, and a new stop is calculated based on the ATR-derived distance.
The unique behavior of this tool occurs during "Adjustment" phases. When the distance between the price and the trailing stop becomes too wide (exceeding the initial ATR multiplier), the script triggers a sigmoid transition. During this phase:
🔹 Visual Cues
🔶 DETAILS
The core of the script is the sigmoid function, which creates a natural-looking transition between two price levels. Mathematically, it maps a linear time input (bars passed) to an S-shaped curve between 0 and 1.
The logic ensures that the "trailing" property is never violated; even during a sigmoid transition, the stop level can only move in the direction of the trend (up for bullish, down for bearish). If the price moves against the trend during an adjustment, the stop will simply hold its level until the price moves favorably again or the adjustment period ends.
🔶 SETTINGS
🔹 General Settings
🔶 USAGE
The indicator functions as a trend-following stop-loss or take-profit level. When the price crosses the trailing stop, the trend direction flips, and a new stop is calculated based on the ATR-derived distance.
The unique behavior of this tool occurs during "Adjustment" phases. When the distance between the price and the trailing stop becomes too wide (exceeding the initial ATR multiplier), the script triggers a sigmoid transition. During this phase:
- The trailing stop line becomes solid (0% transparency) to indicate an active adjustment.
- The stop level moves towards the price following an S-curve, providing a smooth acceleration and deceleration of the stop level.
- The adjustment concludes once the sigmoid duration is reached or if the stop gets too close to the price (defined by the Min Distance setting).
🔹 Visual Cues
- Green Line/Fill: Indicates a bullish trend where the stop is below the price.
- Red Line/Fill: Indicates a bearish trend where the stop is above the price.
- Solid Line: The sigmoid adjustment is currently active, moving the stop closer to price.
- Transparent Line: The stop is in its standard state, maintaining its level or trailing highs/lows.
🔶 DETAILS
The core of the script is the sigmoid function, which creates a natural-looking transition between two price levels. Mathematically, it maps a linear time input (bars passed) to an S-shaped curve between 0 and 1.
The logic ensures that the "trailing" property is never violated; even during a sigmoid transition, the stop level can only move in the direction of the trend (up for bullish, down for bearish). If the price moves against the trend during an adjustment, the stop will simply hold its level until the price moves favorably again or the adjustment period ends.
🔶 SETTINGS
🔹 General Settings
- ATR Length: The lookback period used to calculate the Average True Range, which determines the volatility-based distance of the stop.
- ATR Multiplier: The base distance (in ATR units) used when the trend first flips.
- Sigmoid Length (Bars): The number of bars over which the sigmoid transition occurs once triggered.
- Sigmoid Amplitude (ATR Units): The maximum distance the stop is allowed to travel toward the price during an adjustment phase.
- Min Distance (ATR Units): A safety buffer that prevents the sigmoid adjustment from moving the stop too close to the current price, preventing premature exits.
Phát hành các Ghi chú
- Included style settingsMã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
All content & scripts provided by LuxAlgo are for educational purposes only and are not financial advice.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
All content & scripts provided by LuxAlgo are for educational purposes only and are not financial advice.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.