Trailing Stop Alerts

Dec 21, 2021

Static chart image
Price Action Based
Signals
Trailing-Stop
Volatility

The Trailing Stop Alerts indicator provides an automated ATR-based trailing stop mechanism designed to help traders secure profits and manage risk on open positions by dynamically adjusting exit levels based on price structure and volatility.

Usage

The Usage section describes how the script can be used to manage active trades. To initialize the tool, users must select a starting bar on the chart, which serves as the anchor point for the trailing logic.

Directional Trailing

The indicator can be toggled between "Long" and "Short" modes. In a long position, the script tracks the lowest price over a specific lookback period and subtracts an ATR-based buffer. In a short position, it tracks the highest price and adds the buffer. The stop level only moves in the direction of the trade (up for longs, down for shorts) and will never widen.

Alerting System

The script includes built-in alert functionality to notify users of two specific events:

  • Trailing Stop Update: Triggered whenever the stop level moves higher (for longs) or lower (for shorts).
  • Trailing Stop Hit: Triggered when the price crosses the stop level, signifying a potential trade exit.

Details

The script calculates the trailing stop level by combining structural price data with market volatility. It uses a lowest or highest function over a user-defined lookback period to identify swing points. To account for market noise, it applies an Average True Range (ATR) offset, which is calculated based on the specified ATR length and multiplier.

The script execution is restricted to confirmed bars to prevent repainting. This means the trailing stop will only update or trigger an alert once a candle has closed. If the price hits the trailing stop level during a candle, the stop is reset and the "Hit" condition is met.

Settings

  • Trail Type: Sets the direction of the trade (Long or Short).
  • Lookback: Determines the number of bars used to find the swing high or swing low for the structural stop.
  • ATR Length: The period used to calculate the Average True Range.
  • ATR Multiplier: A coefficient applied to the ATR value to determine the distance of the stop from the price structure.
  • Bar Time: The specific starting point on the timeline where the trailing stop calculation begins.

FAQ

How do I start the trailing stop from a specific trade entry?

When adding the script to the chart or modifying settings, you will be prompted to select a "Bar Time." Click on the candle where your trade was initiated to begin the trailing logic from that point.

Why does the trailing stop not update in real-time?

The script is designed to trigger alerts and updates only on bar close. This ensures that the trailing stop remains stable and does not fluctuate or disappear due to intra-bar price volatility.

How can I access the Trailing Stop Alerts tool?

You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Free access on the following platforms
tradingviewSymbolTradingView
ninjatraderNinjaTrader
metatrader4MetaTrader 4/5
thinkorswimThinkorswim

Unlock Unlimited Access to the LuxAlgo Library

Upgrade your plan to get all indicators, strategies, charts, and full access to Quant, our AI agent.

Trading & investing are risky and many will lose money in connection with trading and investing activities. All content on this site is not intended to, and should not be, construed as financial advice. Decisions to buy, sell, hold or trade in securities, commodities and other investments involve risk and are best made based on the advice of qualified financial professionals. Past performance does not guarantee future results.

Hypothetical or Simulated performance results have certain limitations. Unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, including, but not limited to, lack of liquidity. Simulated trading programs in general are designed with the benefit of hindsight, and are based on historical information. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.

Testimonials appearing on this website may not be representative of other clients or customers and is not a guarantee of future performance or success.

As a provider of technical analysis tools and strategies, we do not have access to the personal trading accounts or brokerage statements of our customers. As a result, we have no reason to believe our customers perform better or worse than traders as a whole based on any content, tool, or platform feature we provide.

Charts used on this site are by TradingView in which the majority of our technical indicators are built on. TradingView® is a registered trademark of TradingView, Inc. www.TradingView.com TradingView® has no affiliation with the owner, developer, or provider of the Services described herein.

Market data is provided by CBOE, CME Group, BarChart, Massive, CoinAPI. Select U.S. equities data is provided through Massive. CBOE BZX real-time U.S. equities data is licensed from CBOE and provided through BarChart. Real-time futures data is licensed from CME Group and provided through BarChart. Select cryptocurrency data, including major coins, is provided through CoinAPI. All data is provided “as is” and should be verified independently for trading purposes.

This does not represent our full Disclaimer. Please read our full disclaimer.

© 2026 LuxAlgo Global, LLC.