All indicators

XPloRR MA-Buy ATR-Trailing-Stop Long Term Strategy Beating B&H

Feb 26, 2018

Static chart image
SignalsMoving AveragesTrailing-StopVolatility

The XPloRR MA-Buy ATR-Trailing-Stop Long Term Strategy indicator provides a systematic framework for long-term trend following designed to outperform a traditional buy-and-hold approach through disciplined entry and exit signals. By combining Moving Average crossovers with an ATR-based trailing stop, the tool aims to capture major market trends while protecting equity during significant pullbacks.

Usage

The Usage section focuses on identifying entry opportunities when momentum shifts and managing risk through dynamic exits. This strategy is primarily intended for long-term investors looking to capitalize on "stock DNA" by fine-tuning parameters to specific assets.

  • Long Entry: A buy signal is generated when the Fast EMA crosses above the Slow SMA, provided the momentum (strength) of the EMA meets a minimum threshold.
  • Trailing Stop Exit: Once in a trade, the script calculates a trailing stop based on a multiple of the Average True Range (ATR). If the price action (represented by a short-term Stop EMA) falls below this trailing level, the position is closed.
  • Trend Exit: A secondary exit condition occurs if a "Fast EMA Sell" crosses under a "Slow SMA Sell" with sufficient downward momentum, acting as a trend-reversal safeguard.

Example configurations for different assets:

  • Apple (AAPL): Users might utilize a Fast EMA of 12 and a Slow SMA of 45 with a 6x ATR multiplier for the trailing stop.
  • Barco (BAR): A setup involving an EMA of 11, SMA of 82, and a 9x ATR multiplier may better fit the asset's historical volatility.

Details

The script operates on the concept that different assets require different sensitivities for trend detection. It uses the ta.ema and ta.sma functions to determine the primary trend direction.

A unique aspect of this strategy is the "Strength" filter. Instead of relying solely on a crossover, the script calculates the percentage change of the Moving Average (10000 * (ema - ema[1]) / ema[1]). This ensures that entries and exits only occur when the trend has sufficient velocity, filtering out "choppy" or sideways price action. The trailing stop logic is path-dependent; it only moves upward during a long trade, calculated by subtracting a multiple of the 15-period ATR from the current stop EMA value.

Settings

Time Period

  • Start/Stop Year/Month/Day: Defines the backtesting window for the strategy execution.
  • Background: Toggles the visual highlight for the active backtesting period.

Buy Parameters

  • Fast EMA Buy: The period for the exponential moving average used for the long entry crossover.
  • Slow SMA Buy: The period for the simple moving average used as the baseline for the long entry.
  • Minimum Buy Strength: The required velocity of the Fast EMA to confirm a valid buy signal.

Sell Parameters

  • Fast EMA Sell: The period for the exponential moving average used for the trend-based exit.
  • Slow SMA Sell: The period for the simple moving average used for the trend-based exit.
  • Minimum Sell Strength: The required downward velocity to trigger a trend-reversal exit.

Trailing Stop

  • Trailing Stop (#ATR): The multiplier applied to the 15-period ATR to determine the distance of the trailing stop from the price.

FAQ

How do I adjust the strategy for different stocks?
Since every stock has different volatility profiles, you should adjust the EMA/SMA periods and the ATR multiplier until the historical trades align with major trend moves on your specific chart.

What determines the "Strength" of a signal?
Strength is a calculation of the slope of the Moving Average; higher values require a steeper trend to trigger an entry, while lower values allow for entries on shallower moves.

How can I access this tool?
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.