Trend confirmation filter
Lets a signal through only while the short EMA sits above the long EMA; it never fires as shipped.
TrendConfirmationFilter passes an input signal through only on bars where a fast EMA of the close is above a slow EMA, 10 and 50 bars by default. Its docstring says multi-timeframe, but both averages run on the same one-minute closes. As shipped, the two averages are built but never hooked up as inputs, so they never update and the filter returns nothing on every bar; in tests at four settings on 3,000 SPY bars it never fired.
How to read it
- Markers sit on candles where the input signal passed the trend gate. This indicator draws none on SPY one-minute bars at any setting tested.
- A candle with no marker means either no input signal or a bearish trend. The chart does not show which, and the averages are not drawn.
- An empty chart here does not mean a quiet market. It means the filter is broken.
What it outputs
- Filtered signal
- The input signal, passed through on bars where the short EMA is above the long EMA. Draws nothing as shipped.
When it fires
Intended: the input signal fires on a bar where the short EMA is above the long EMA, meaning the close is trending up at that moment. As shipped it never fires, at any setting, so no marker appears.
Settings
- short_window
- Length in bars of the fast EMA of the close. A shorter window turns bullish sooner, so more signals would pass; a longer one needs a sustained rise. No visible change today, because the filter returns nothing at any value.
- long_window
- Length in bars of the slow EMA of the close. A shorter window makes the bullish test easier to pass, a longer one stricter. No visible change today, because the filter returns nothing at any value.
Pitfalls
- Never fires as shipped: the two averages are created but not connected to the filter, so they never update and it returns nothing. The presets above will still draw nothing until that is fixed.
- The docstring says multi-timeframe, but both averages use the same one-minute closes. It is a single-timeframe trend gate.
- As written, the averages only update on bars where the input signal is present, so a sparse signal leaves the trend average built from signal bars only.