Multi timeframe momentum
How many of six bullish momentum and trend checks pass, scored from 0 (none) to 1 (all).
MultiTimeframeMomentum measures rate of change over three lookbacks (default 3, 10 and 20 bars) and three EMAs (default 5, 13 and 21) on the close. Each bar it adds fixed points: 0.30 if all three rate-of-change readings are above zero, 0.20 if the short one exceeds 1.5 times the medium one, 0.20 if the short and medium readings both rose since the last bar, 0.15 if the EMAs stack fast above medium above slow, 0.10 if price is above the fast EMA, and up to 0.05 for consecutive all-positive bars. The name says multi-timeframe, but these are lookbacks on one-minute bars, so the defaults span 3 to 20 minutes. The score only measures bullishness and never goes negative.
How to read it
- The line sits in its own pane below the price, always between 0 and 1.
- Near 0 means none of the bullish checks pass. Reaching 1.0 needs all six, which takes five or more bars in a row with all three readings up.
- With default settings on SPY one-minute bars, the median reading was 0.30 and 95% of bars stayed at or below 0.78.
- A rise toward the top means more checks are passing together. A fall toward 0 means they have stopped passing, which is not the same as price falling.
What it outputs
- Momentum score
- How many of the six bullish checks pass, weighted into a value from 0 (none) to 1 (all).
Settings
- short_window
- Lookback in bars for the fastest rate of change. Lower values flip the all-positive and short-acceleration checks bar to bar; higher values smooth them. Nothing enforces short below medium, so swapping them changes what the 1.5x check compares.
- medium_window
- Lookback for the middle rate of change. The short-stronger check needs the short reading to beat 1.5 times this value, and medium acceleration uses it too. Longer values react later and change less often; shorter values flip the checks more often.
- long_window
- Lookback for the slow rate of change, which only feeds the all-positive check (0.30). Longer values need price to be up over a longer span before that weight counts, so it is lost more often. It also sets the warm-up: the first long_window bars give no score.
- ema_short
- Length of the fast EMA. It drives the price-above check (0.10) and must sit above the medium EMA for the stack check (0.15). Shorter lengths hug price and flip the price-above check more often; longer lengths lag and hold their side longer.
- ema_medium
- Middle EMA of the stack check (0.15). The check needs the fast EMA above it and it above the slow EMA, so values close to either neighbour make the stack flip more often.
- ema_long
- Slow EMA of the stack check (0.15). The medium EMA must sit above it. Longer lengths lag further behind price, so the stack check changes less often.
Pitfalls
- The score only measures bullishness. It never goes negative, so 0 means no bullish checks passed, not that price is falling. A downtrend and a flat market both read near 0.
- The 1.5x check is sign-blind. If the medium reading is negative, the short reading only has to beat a more negative line, so the 0.20 can fire while both readings are falling.
- The weights are hand-set in the code, not fitted or tested for predictive value. The docstring promises high-probability explosive moves, and nothing in the code measures that.