IU Trailing Stop Loss Methods
Jan 18, 2025

The IU Trailing Stop Loss Methods tool provides a comprehensive suite of 12 dynamic risk management techniques to protect capital through automated trailing stop-loss adjustments and real-time alerts.
Usage
The script is designed for traders who require a flexible way to manage open positions using various technical indicators. To use the tool, users must specify the trade start time via the Date setting and select the Trade direction (Long or Short). The indicator will then simulate an entry at the open price of the specified bar.
The core functionality is determined by the Trailing SL method selection:
- Indicator-Based (ATR, SAR, Supertrend, EMA, StdDev): Uses standard technical indicators to define the stop-loss distance.
- Static-Based (Point/Pip, Percentage): Maintains a fixed distance from price or entry.
- Price Action (Highest/Lowest): Trails behind the highest high or lowest low of a specific lookback period.
- Target-Based: These methods (ATR, Point, Percentage, Standard Deviation Target Based) progressively tighten the stop-loss as price hits predefined movement milestones in favor of the trade.
The Exit Trade After Close? setting determines if the trade closes immediately upon a price breach (intrabar) or waits for the candle to close for confirmation.
Details
The script executes by tracking a single trade from a user-defined timestamp. For methods like ATR or Standard Deviation, the stop-loss is calculated dynamically each bar and updated to ensure it only moves in the direction of the trade (up for longs, down for shorts).
The target-based logic utilizes internal arrays to track price progression. As price moves a certain distance (defined by the chosen multiplier or point value), the stop-loss is "ratcheted" forward. This ensures that profit is locked in systematically as the trade develops. Note that on historical data, if both entry and exit occur within the same candle, the script may not visualize the trade due to the lack of intrabar sequence data (OHLC movement).
Settings
Main Settings
- Algo Mode: Enables or disables algorithmic processing for the script logic.
- Date: The exact timestamp where the trade is initiated.
- Trade direction: Sets the position type to either Long or Short.
- Choose the Trailing SL method: Selection menu for the 12 available stop-loss calculation methods.
- Exit Trade After Close?: When enabled, triggers exit signals only on candle close; otherwise, triggers on price touch.
- Show the PNL?: Displays the Profit and Loss on the chart with detailed entry/exit labels.
Indicator Groups
- ATR Settings: Controls the period and multiplier for ATR-based methods.
- Parabolic SAR Settings: Configures the Start, Increment, and Maximum parameters for the SAR calculation.
- Supertrend Settings: Sets the Length and Multiplier for Supertrend-based trailing.
- Point/Pip Based: Defines the fixed distance in points or pips.
- Percentage Based: Defines the stop-loss distance as a percentage of the entry price.
- EMA Settings: Sets the period for the Exponential Moving Average trailing line.
- Standard Deviation Settings: Configures the lookback period and multiplier for volatility-based stops.
- Highest/Lowest Settings: Sets the lookback window to find the peak or trough for trailing.
- Target-Based Inputs: Specific multipliers and lengths for the four target-based ratcheting methods.
FAQ
How do I use this script for a specific trade I already took? You can align the "Date" and "Trade direction" settings to match your actual entry. The script will then calculate the trailing stop-loss values from that point forward based on your chosen method.
Why does the stop-loss line only move in one direction? The script uses a "peak" or "valley" logic to ensure the stop-loss never widens. For a long position, the stop-loss will only move up or stay flat; it will never move down.
How can I access the IU Trailing Stop Loss Methods? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.