How to Detect When Any Indicator Changes Slope: The Shifted Crossover Technique-Do It Yourself series — The Indicator Store

 Every trader who follows a moving average eventually asks the same question: how can I know, objectively and without delay, the moment the line turns? In this article we explain a simple technique that answers that question for any indicator, how to filter out false signals, and how to automate the result in NinjaTrader 8.

The idea: cross an indicator with itself

We usually think of crossovers as two different lines: a fast moving average against a slow one. But there is another way to use crossovers.

Take any indicator — in the video we use the HMA (Hull Moving Average) with a period of 50, one of the fastest-reacting averages and with only one parameter to adjust. Now add a second copy of exactly the same indicator and shift it one bar into the past.

When the line is rising, the current value is above the value of the previous bar. When the line starts falling, the current value drops below it. That moment is a crossover between the line and its shifted copy, and it marks exactly where the slope changed.

In the video we first shift the copy five bars so the effect is easy to see, and then return to one bar, where both lines are almost on top of each other but the crossovers still mark every turning point.

This technique works with any line: the HMA, the T3, an oscillator, or any indicator you prefer.


The problem: market noise

With a shift of one bar, the technique is very sensitive. Inside a clear trend, a tiny wiggle in the line can produce a crossover that does not represent a real change of direction. A histogram of the distance between the line and its shifted copy makes these small values easy to see.

There are two ways to reduce these false alarms.

1. Compare against more bars back. Instead of comparing the current value with one bar ago, compare it with two, three or four bars ago. The small wiggles disappear, but the signal arrives later: you need to wait those extra bars to confirm the change.

2. Use a threshold. Instead of requiring the distance between both lines to cross zero, require it to exceed a minimum value. In the example from the video, the false signal had a distance of about 0.13, so a threshold of 0.2 removes it. The advantage of this method is that real signals are detected with no additional delay.

A trend filter with linear regression

A third refinement is to accept only the signals that agree with the broader trend. The TIS HMA Crossover indicator includes a linear regression line for this purpose (period 100 in the example). When the slope of the linear regression is positive, the market is considered to be going up, and short signals are ignored. When the slope is negative, long signals are ignored.

The indicator's parameters are:

  • HMA period (50 in the example)
  • Linear regression period (100 in the example)
  • Optional smoothing for the linear regression (1 = no smoothing)
  • A threshold for the HMA crossover
  • A threshold for the linear regression slope

When a signal appears, the entry would be at the close of the signal bar.

Automating the signals

The TIS HMA Crossover exposes two plots, CrossoverUp and CrossoverDown. Each plot has no value (N/A) until a signal appears, and then it holds the price where the triangle is painted. Any automation system can read these plots.

With NinjaTrader Strategy Builder: create a strategy that checks whether the CrossoverUp or CrossoverDown plot has a value, and enter the trade when it does.

With Markers Pro: create two copies of the indicator's plots, one named Go Long (from CrossoverUp) and one named Go Short (from CrossoverDown). Each name must be unique. Mark both copies as fast signals, select the fast signal mode with those names in Markers Pro, and choose your preferred ATM strategy from Chart Trader. Markers Pro will then execute that ATM on the selected account every time a signal appears, while you keep the option of trading manually from Chart Trader.

The same copied signals can also be used as variables inside other logical conditions, for example as a filter for a different strategy.

Optimize the parameters

The TIS HMA Crossover includes a strategy, so you can run it in the NinjaTrader Strategy Analyzer and optimize the HMA period, the linear regression period and the thresholds for your instrument and timeframe.

Watch the full video:



If you have questions about this technique, join our Discord community. Access is free, and the instructions to join are in the video description.









Comments

Popular posts from this blog

How to Use NinjaTrader Templates to Save, Load, and Transfer Chart Setups

Markers 2026 October Release: Global Control, Risk Limits and Telegram | The Indicator Store

Trading a Moving Average