I am not fond of gapless indicators. I think that there scope of application is pretty limited. If you look at FOREX, crude oil, gold and other commodities, why would you consider to eliminate part of the price data and declare it void? To me this looks like a strategy of a US born ostrich, which put its head down in the sand while Asian and European traders are continuing there battle over prices. The world is less and less dependant on the US economy, trading volumes will gradually decline during the US session and increase ofr the Asian and European session.
The only instruments where gaps are still valid are those that have strong regional background and which are not linked to the global economy. To a limited extent this is true for index and treasury futures.
But let us look at the mechanics of a gapless oscillator versus an oscillator that resets at the beginning of the regular session. For that purpose let us consider the following scenario:
Yesterday ES has been closing near its daily low. The oscillator has moved far into negative territory. During the night session prices have first retraced, then tested the low and moved up above yesterday's midline. The sentiment has now changed.
Gapless indicator: The gapless indicator continues its journey where it stopped at the session close the prior day. The negative values are carried over into the new trading day. Thus the indicator will produce negative values during the beginning of the new session.
Resetting indicator: The oscillator is reset to zero at the beginning of the session. Today's values are only calculated from the data of today's regular session.
I have often used resetting indicators, such as the VWAP or a SMA calculated from the NYSE Tick. Both reset at the beginning of the session and their values do not depend on yesterday's price action. However the gapless indicator carries its burden from yesterday. I really don't want to see that burden on my regular session chart, as it has been neutralized or at least changed by the price action that has taken place during the night session.
In our scenario described above, the resetting indicator would show a gap: it would gap up from the oversold territory and restart at zero. The gapless indicator would show a smooth transition, but it lies about the markets!
The following user says Thank You to Fat Tails for this post:
The indicator called trigger lines is an extremely simple indicator. The lead line is a linear regression indicator - it plots the end point of a linear regression line calculated from the last N data points. The signal line is an exponential moving average of the lead line. Both lines can be directly built with NinjaTrader default indicators, as you can use the LinReg indicator as an input series for the EMA to generate the signal line.
The trigger lines indicator has been made popular by the NEXGEN T-3 system, but you will find it in many other trading systems. A single LinReg(34) line can be used as a trendfilter on any chart. The trend is up, when price is above the LinReg(34), the trend is down, when it is below.
Coloring the space between two plots
The interesting problem here is to color the space between the two plots depending on whether the lead line is above or below the signal line. This is not as easy as someone might think. There are a few points to consider:
- DrawRegion() which is used to color the space between the plots, can slow down NinjaTrader. It is therefore necessary to avoid cutting the filled area into many little spaces, but let DrawRegion() cover an entire segment.
- When the indicator is set to COBC = false, preliminary signals which are not confirmed with the bar close, need to be removed.
- When the indicator is displaced, the colored space between the indicators also needs to be moved back or forth accordingly.
Exposing the trend as a BoolSeries
The indicator also exposes the trend as a BoolSeries, which can be directly accessed from a (manually coded) strategy. If you wish to access the trend via the Market Analyzer or the Strategy Builder, you would need to replace the BoolSeries with a transparent plot instead.
Here is the link to the indicator. I have made the last update 2 days ago, as the old indicator did not well respond to a negative shift.
Indeed I use the anaMovingMedianVWTPO as a sort of trend filter on a sleepy backwater instrument that is of little consequence globally. It doesn't even trade 24/7 and misses 80% of the Asian trading session. The DAX.
It's from a head in the sand place called ... (let me look ... ) oh yeah. Germany.
This is the gap from this morning. As you can see in this chart I have combined it with a VWAP.
I like the idea of the MovingMedianVWTPO.
The thing about a gap, on index futures like the DAX is that it occurs with no volume.
The following 2 users say Thank You to podski for this post:
I agree. The FDAX has two separate sessions within the same trading day. In the morning it follows European news at its own pace. In the afternoon - that is after 1:00 PM CET - it is driven by expectations or news coming from overseas. In the afternoon there is no reason to trade the FDAX, as you can directly trade US index futures which should have a higher volatility.
The following 2 users say Thank You to Fat Tails for this post:
This may not be the right place for this question but generically speaking, how is this accomplished for any signal generating indicator? Can you share the approach or generic part of the code to remove non-confirmed signals on bar close with COBC = false?
When an indicator is set to COBC = false, all plots are typically recalculated with every incoming tick. Because plots are reset to the correct value, they do not need to be removed.
However, if you have a preliminary signal that generates a draw object such as an arrow, you need to check with every incoming tick, whether the signal is still valid. In case that a new tick invalidates the preliminary signal, you need to remove the draw object. This is achieved with the NinjaScript command RemoveDrawObject("tag"), where the tag is the label that was chosen for the draw object that you wish to remove.
The following 3 users say Thank You to Fat Tails for this post: