How to Turn the Slope of Any Line into a Filter or a Signal in NinjaTrader 8



Is your moving average going up or going down? That simple question can work in two ways: as a filter (only take longs while the line rises) or as a signal (enter when the line changes direction). Marker Slope, one of the indicators included with Markers, does both, with any line on your chart.

This is part of a series of short videos where we explain Markers piece by piece.

Key takeaways

  • Marker Slope measures the slope of any line: a moving average, a channel, or an indicator in another panel.
  • The slope is stored in a variable, MySlope by default, that you can use as a filter: longs above zero, shorts below.
  • The same tool creates signals every time the slope changes direction.
  • Apply Threshold turns the slope into 1 and -1, useful for lines that are often flat.
  • Slope Bars smooths the slope and Threshold ignores small moves, two ways to remove false signals.

Step 1: add Marker Slope to a line

In the video we start with an HMA with a period of 180, but it can be any line.

  1. Add Marker Slope to the chart.
  2. Choose your signal for longs and for shorts (an arrow, a background color, a vertical line).
  3. In Input Series, select the indicator and the line you want to measure.

Below the chart you get a histogram: the higher the bar, the steeper the positive slope; the lower, the steeper the negative slope.

Step 2: use MySlope as a filter

The histogram values are stored in a variable, MySlope by default, and you can use it anywhere. To use it as a filter in Markers:

  • Enable the filters.
  • Longs: MySlope greater than zero.
  • Shorts: MySlope less than zero.

Specifying the bar is optional; if you don’t, the current bar is used. With the filter on, longs are disabled while the slope is negative and only shorts are enabled, and the other way around. You can turn the filter on or off at any time.

Step 3: turn the slope into signals

The same tool creates signals: a long when the slope goes from negative to positive, and a short when it goes from positive to negative. In the video we switch the small default arrows for dashed vertical lines in a more visible color.

Detecting objects vs. fast signal mode

To send those signals to Markers there are two options:

  • Detect objects: Markers looks for the vertical line on the chart, and the color has to match exactly. This is the older method, and we don’t recommend it.
  • Fast signal mode: give each signal a name, for example MyLong and MyShort, and create those fast signals in Marker Slope. Markers then waits for them directly.

Lines that are often flat: Donchian channel and Apply Threshold

Some lines are horizontal for long stretches. The middle line of a Donchian channel is a good example: its slope is zero for many bars.

In the video we measure the middle line of a Donchian channel with a period of 83. The signals are clear: a long when the line starts rising, a short when it starts falling. As a trigger, that works well.

To use it as a filter, enable Apply Threshold. The histogram becomes 1 and -1, and MySlope (or whatever name you give it) can be used as:

  • Longs: MySlope equal to 1.
  • Shorts: MySlope equal to -1.

Not only on the price panel: the ADX

Marker Slope works with lines in other panels too, because all you need is the indicator and the line. In the video we measure the ADX with a period of 14.

The ADX goes up and down often, so the result is a lot of signals. That leads to the next two settings.

Slope Bars: smoothing the slope

Slope Bars smooths the slope. In the video we raise it step by step, to 3, then 5, then 7, until the histogram is smooth enough. Fewer direction changes mean fewer signals.

Threshold: ignoring small moves

Even with a smooth slope, some signals come from a line that is barely moving. Threshold sets the minimum slope needed to trigger a signal. In the ADX example, a threshold of 1.5 means the slope has to break that value before a signal appears.

The ADX is used here only to show how the threshold works, not as a trading signal.

Smoothing and threshold together: HMA 50

Back on an HMA, now with a period of 50, the slope changes direction many times and creates a long sequence of shorts and longs. With a threshold of 3.75, only the moves where the slope breaks that value remain: a long, a short, a long. When the slope is positive but not positive enough, there is no signal.

Smoothing and threshold are the two settings to adjust, depending on the line and the market.

Watch the video

Tools mentioned

Trading futures involves substantial risk. Nothing in this article is a recommendation to trade or a promise of results. Risk disclosure: https://go.theindicatorstore.com/risks

Comments

Popular posts from this blog

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

Setup Darvas Squeeze - The Best Indicator Combo for NinjaTrader 8

Markers Plus System for Ninjatrader (new version 4)