Search This Blog

Wednesday, July 3, 2019

TIS_HMA_Crossover Indicator for NinjaTrader

The TIS_HMA_Crossover Indicator for NinjaTrader follows the Setup described on this video :
and it uses 2 lines :
  • A fast HMA
  • A Slow Linear Regression
And as many may think, we are not looking for the crossover between those 2 lines....no...

The Entry signals are produced by the HMA line crossing with a copy of itself, displaced 1 bar :

Here we have a chart with a fast HMA , using a period of 33 :


And now, we add another HMA, with the same period but displaced 1 bar using the displacement input parameter.
On this chart, it is in color blue :

If we look at where those crossovers happen, these are our entry points

Lets go to the results painted by the custom indicator TIS_HMA_Crossover, where the signals are the blue and red triangles : ( ignore the black line by now )


As we can see, we get signals where the red line changes its slope from trending up to down and so on...

Now, lets describe the black line ; it is a linear regression because its main feature is to remain linear, so its a good way to define a trend, given the last N bars.
We use the Black Line as a Filter ; when it is sloping up, we only take long signals, when it is sloping down, we only take short signals.

Here is an example, where we avoid the first 2 shorts because the black line on those bars is sloping up :


Something to take into account is the way to measure the slope.
I do not use angles, because the result is relative to the chart X-Y compression ; if we expand the X axis, the angle change...
I use something very simple, but effective : the slope of a line is the difference between the current value and the value 1 bar back.
To calculate that, we can use the Momentum Indicator, with a period of 1, and placing inside the input series, the indicator whose slope we want to measure.
And we get something like this :

We can see the relation between the slope of the red line and the histogram ; when the red line is flat ( horizontal ), the histogram is zero. When the red line is sloping down, the histogram is negative.
So we can measure the slope and get not only its trend, up or down, but also its magnitude.
Then we can define our filter to take longs when the slope is positive and bigger than a threshold, and take shorts when the slope is negative and below a threshold.
On this example, a threshold of 0.2 seems to work fine, because we avoid the long ( blue triangle ) but take the short ( red triangle ):


In a similar way, we can also specify a threshold for the Red Line, to avoid creating fake signals when it is oscillating on an almost horizontal state.
That way, in total we have 4 input parameters for this setup :

  1. Period of the HMA , the red line that creates the Entry Signals
  2. Period of the LinReg, the black line used to filter the entry signals
  3. Threshold for the HMA, to reduce the number of fake signals
  4. Threshold fo the LinReg, to define a consolidation are where not taking any trade
As we can see on the settings of the indicator we have these 4 input parameters:


And also the option to paint the background with the trend defined by the slope of the black line.
And as we can see on this chart, if we use a threshold different than zero, then we have 3 possible background trend colors ; trending up, trending down and no trending :



This logic can be easily implemented with the Strategy Builder on NinjaTrader 8 and the Indicator TIS_HMA_Crossover includes an open code strategy so you can edit the code, learn how it works, execute performance reports and modify the logic to create your own Setup.

Contact me for more info at Pablo@TheIndicatorStore.Com

Visit our Free Chat Room on Discord : http://bit.ly/TIS_Room


Pablo Maglio
photo
The Indicator Store
Skype Skype id : pmaglio
     
Risks


No comments:

Post a Comment