Trailing Stop
Jul 1, 2024

The Trailing Stop indicator provides a dynamic risk management solution that automatically adjusts stop-loss levels based on price movement to protect profits and limit downside risk. By shifting from static to adaptive price levels, this tool helps traders maintain a disciplined exit strategy across various market conditions.
Usage
The Usage section describes how the script can be used to manage open positions. The indicator is designed to be activated for specific trades by defining a starting point and a risk tolerance percentage.
- Long Positions: When configured for a "Sell" order (trailing a long position), the indicator tracks the highest price reached since the start date. If the price drops by the user-defined percentage from that peak, a "Sell" signal is triggered.
- Short Positions: When configured for a "Buy" order (trailing a short position), the indicator tracks the lowest price reached since the start date. If the price rises by the user-defined percentage from that low, a "Buy" signal is triggered.
- Visual Interpretation: A continuous line plots the current trigger price on the chart. The area where the trailing stop is active is highlighted, and once the price crosses the stop level, a visual label indicates the exit signal.
Details
The script executes by monitoring the price action relative to a fixed start time. Unlike standard trailing stops that might reset frequently, this tool focuses on a specific trade entry timeframe.
The logic calculates the "Peak Price" (highest high for long stops or lowest low for short stops) recorded since the Trailing Stop Start Date. The "Stop Price" is then derived by applying the Trigger Delta (%) to that peak. This ensures that the stop level only moves in the direction of the trade (up for longs, down for shorts) and never retracts, effectively "locking in" gains as the market moves favorably. The script includes built-in alert conditions to notify traders the moment the closing price violates the trailing threshold.
Settings
General Settings
- Trailing Stop Start Date: Sets the specific timestamp from which the indicator begins tracking price peaks and calculating the stop level.
- Trigger delta (%): Determines the percentage distance between the peak price and the trailing stop level. A higher percentage allows for more market volatility, while a lower percentage tightens the exit.
- Order: Selects the direction of the trade being managed. "Sell" is used to trail a long position (stops below price), and "Buy" is used to trail a short position (stops above price).
FAQ
How do I access the Trailing Stop?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Can I use this for both Long and Short trades?
Yes, you can toggle the "Order" setting between "Sell" (for long exits) and "Buy" (for short exits) to match your current market position.
Does the stop level move backwards if the market goes against me?
No, the logic is designed to only move in the direction of profit. For long positions, the stop only moves up; for short positions, it only moves down.
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.