How to Combine Signals From Any Indicator Within N Bars in NinjaTrader 8


  Trade only when two or three signals show up close to each other. How to build signal confluence in a window of N bars with Markers and with Strategy Builder

How do you trade only when two or three signals from different indicators show up close to each other? Signals rarely land on the same bar. The solution is a window of N bars, defined by you, where every signal has to be present before an order is sent.

This guide shows how to build that window in NinjaTrader 8 with Markers and with Strategy Builder.



Key takeaways

  • Confluence means every signal is present inside a window of N bars.
  • To get there, each signal has to stay “on” for N bars after it appears.
  • If the signal has a plot, you can extend it with Sustain in Markers or with the Maximum of the last N bars, in Markers or in Strategy Builder.
  • If the signal is only an object on the chart (an arrow, a triangle, a dot with no plot behind it), you need Marker to Plot, included in Markers Pro.
  • The order goes out when every extended signal is greater than zero on the same bar.

Step 1: create a signal

Take a four-bar reversal pattern: the current bar is green, the previous bar is green, and the two bars before that are red. With Marker Logic, or with Strategy Builder, that is four conditions:

  • Close[0] > Open[0]
  • Close[1] > Open[1]
  • Close[2] < Open[2]
  • Close[3] < Open[3]

When all four are true, you have a signal. Trading that signal alone is simple. The challenge starts when you want to add a second one.

The problem: signals don’t land on the same bar

Add a second indicator, for example a trend indicator that marks each change in direction. Sometimes both signals appear on the same bar. More often they are two, three or more bars apart.

What you want is a rule like this: if both signals appear within a window of no more than N bars, trade. How you build that window depends on how each signal is drawn.

Signals with a plot

Option 1: Sustain, in Markers

If the signal is created with a Markers tool, such as Marker Logic, use the Sustain option. It keeps the condition true for the number of bars you choose after the signal appears.

Extend both signals and they start to overlap. In the example in the video, a Sustain of 5 was not enough, and 7 made the two signals meet.

Option 2: the Maximum of the last N bars, in Markers or in Builder

When the signal comes from an indicator without a Sustain option, extend it with the Maximum of the last N bars of its plot:

  • In Markers: use Marker Copy, and in Input Series choose the Maximum of the indicator’s signal plot over N bars, with the same parameters as the indicator on the chart.
  • In Strategy Builder: reference MAX directly, for example the maximum of the last 5 bars of the indicator’s signal plot. You don’t need to copy anything or draw it on the chart.

Make sure you pick the plot that carries the signal, not the indicator’s main line.

When there is a signal, the value is the price where it was drawn. When there is none, the value is zero. That is what lets you combine them.

Plots vs. objects

Many indicators draw an arrow on the chart and also have a plot behind it, sometimes almost invisible. Check the indicator’s parameters: if you can change the arrow into a triangle, a square or nothing at all, and a small dot remains, that dot is the plot, and you can work with it.

Most of our own indicators include both: the object for the visual and the plot for the logic.

Signals that are only objects: Marker to Plot

If the indicator only paints objects and there is no plot behind them, Strategy Builder cannot read them. That is where Marker to Plot, included in Markers Pro, comes in:

  • You define the object to detect, for example an arrow up, and its exact color.
  • When that object is painted, Marker to Plot turns it into a variable with a value, and you can sustain it for N bars like any other signal.
  • It works in real time: objects are detected when they are painted, so there are no values on historical bars.
  • The bar where the object is detected counts as the first bar of the window. For a window of three bars, set two.

Putting it together: trade when everything is above zero

With each signal extended, the rule is simple: if every variable is greater than zero on the current bar, all the signals are inside the window, and you send the order.

In Strategy Builder, with two variables, for example one for the bar pattern and one for the maximum of the trend signal:

  • BarPattern[0] > 0
  • MaxTrend[0] > 0

When both are true, you have confluence. In the video, a window of 6 bars was not enough, and 7 made the two signals overlap.

Use the same window on every signal. You don’t know which one will come first, and the window has to cover the one that appears earlier.

Markers Plus or Markers Pro?

  • Sustain and Maximum: available in Markers Plus and in Markers Pro, and the Maximum also works in Strategy Builder.
  • Marker to Plot: only in Markers Pro. It’s the only way to use signals that are just objects on the chart.

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

Markers Plus System for Ninjatrader (new version 4)

Setup Darvas Squeeze - The Best Indicator Combo for NinjaTrader 8