All indicators

Trend Magic

Feb 14, 2021

Static chart image
SignalsOscillatorsTrailing-StopVolatility

The Trend Magic indicator provides a visual trend-following system by combining momentum and volatility components to identify potential entry and exit points across various financial markets.

Usage

The Trend Magic tool is used primarily for trend confirmation and as a dynamic trailing stop. It changes color based on the relationship between price momentum and calculated volatility levels. Traders can interpret the script as follows:

  • Bullish Trend: When the line is green, it indicates a bullish bias. This occurs when the Commodity Channel Index (CCI) is positive.
  • Bearish Trend: When the line is red, it indicates a bearish bias. This occurs when the CCI is negative.

The script is effective for identifying trend reversals. For example, a "Buy" signal is often considered when the low price crosses above the Trend Magic line during a bullish transition, while a "Sell" signal occurs when the high price crosses below the line during a bearish transition. It is applicable to Forex, Crypto, and Stock markets.

Details

The script's logic is built upon two core technical pillars: momentum and volatility. It was originally popularized on the MetaTrader platform and was later ported to Pine Script by Kıvanç Özbilgiç.

  1. Volatility (ATR): The script uses an Average True Range (ATR) calculation combined with a multiplier to create a trailing stop-loss style logic. This determines the vertical distance of the line from the price.
  2. Momentum (CCI): The Commodity Channel Index (CCI) acts as the primary trend filter. The direction of the trend and the subsequent color of the indicator line are determined by whether the CCI value is above or below the zero midline.

The indicator logic ensures that the line remains flat during periods where the calculated trailing level does not exceed the previous bar's level, creating a "step" effect that helps filter out minor price fluctuations.

Settings

Inputs

  • CCI Period: The lookback period used for the Commodity Channel Index calculation. A higher value results in a slower, more stable trend filter.
  • ATR Multiplier: The coefficient applied to the ATR. Increasing this value places the indicator line further from the price, reducing sensitivity.
  • ATR Period: The lookback period used to calculate the Average True Range for volatility measurements.
  • Source: The price data (e.g., Close, Open, HL2) used as the basis for the calculations.

FAQ

How does Trend Magic determine trend changes? Trend changes are triggered by the Commodity Channel Index (CCI). When the CCI crosses above zero, the indicator switches to a bullish (green) state; when it crosses below zero, it switches to a bearish (red) state.

Can I use Trend Magic for setting stop losses? Yes, the ATR-based calculation allows the indicator to function as a dynamic trailing stop, providing a visual level where a trend might be considered invalidated.

How can I access Trend Magic? 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.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.