ES · Backtest
Which simple intraday trend-and-momentum filter stays active longer?
What we learned
The version using completed 15-minute and hourly candles gives fewer interruptions. It allows trades for about 45 minutes in the middle-length period, compared with 4 minutes when both calculations are updated every minute.
However, neither combination usually stays continuously switched on for 3–4 hours. The direction calculation itself is much steadier. The one-hour momentum check repeatedly turns permission to enter trades off and back on.
Checking the minute-based version only every 15 minutes makes its results almost the same as the completed-candle version. How often we update the decision explains most of the difference.
1. Exactly what did we calculate?
There are two separate questions. Direction: is a smoothed price average rising or falling? Momentum: is the latest closing price above or below its closing price one hour earlier?
Version 1: 15-minute momentum + hourly direction
Use an EMA20 calculated from hourly closing prices. EMA means exponential moving average: a running average that gives more weight to recent prices.
Direction change = latest completed hourly EMA20 − that EMA20 three hourly candles earlier Momentum = latest completed 15-minute close − close four 15-minute candles earlier
Update direction when an hourly candle finishes. Update momentum at :00, :15, :30 and :45. Keep each result until its next scheduled update.
Version 2: both calculations on 1-minute candles
Use an EMA1200 calculated from one-minute closing prices. The longer length gives roughly the same smoothing time as hourly EMA20.
Direction change = latest minute EMA1200 − that EMA1200 180 minute candles earlier Momentum = latest completed minute close − close 60 minute candles earlier
Update both numbers after every completed one-minute candle. The decision can therefore change every minute.
For either version, a positive direction change means an upward bias; a negative change means a downward bias. A positive momentum number means the latest price is higher than an hour earlier; a negative number means it is lower.
The trade-permission rule is the same for both:
IF direction change > 0 AND momentum > 0:
allow long entries
ELSE IF direction change < 0 AND momentum < 0:
allow short entries
ELSE:
allow no new entries
If either number is exactly zero, allow no new entries.
Example with made-up prices
At 10:15 a.m., the latest completed hourly EMA20 is 6,000 and its value three hourly candles earlier was 5,990. The difference is +10, so direction is upward.
The latest 15-minute close is 6,010 and the close at 9:15 a.m. was 6,000. Momentum is also +10. Both are positive, so long entries are allowed.
If momentum later becomes negative while the EMA direction stays upward, new entries pause. That pause does not by itself change the underlying upward bias.
Only finished candles are used. A one-minute candle labelled 10:14 covers 10:14–10:15; its close becomes usable at 10:15. We do not use its final closing price before then.
2. What counts as one uninterrupted signal?
In this report, one period means consecutive minutes allowing the same trade direction. The period ends when permission turns off, changes to the other direction, or the measured day ends.
| Illustrative time | Decision | How we count it |
|---|---|---|
| 10:00–10:15 | Allow longs | First long period: 15 minutes |
| 10:15–10:30 | No new entries | A pause; not an active period |
| 10:30–11:00 | Allow longs again | Second long period: 30 minutes |
| 11:00–11:15 | Allow shorts | Third period: 15 minutes, now short |
The two long periods count separately, even if the EMA bias stayed upward throughout the pause. A day that begins with an existing signal also counts that signal's observed portion as one period.
How to read the measures below
- Periods per day: count all long and short periods on each measured day, then average those daily counts. Three periods one day and four the next give an average of 3.5.
- Middle-length period: sort every observed period from shortest to longest and take the middle value. This is the median; it is not the arithmetic average.
- Periods ending within 30 minutes: number of periods lasting 30 minutes or less ÷ total periods × 100.
- Days with a 3-hour period: number of measured days containing at least one uninterrupted period of 180 minutes or more ÷ total measured days × 100.
- Time allowing trades: minutes allowing either longs or shorts ÷ all measured minutes × 100.
We measure only the part inside 9:30 a.m.–4:00 p.m. A signal already active before 9:30 starts our clock at 9:30. A signal still active at 4:00 stops our clock at 4:00. We do not claim either signal actually changed at those boundaries.
3. What happened in the backtest?
Both versions were compared over the same 342 days and the same 390 minutes per day.
| Question | 15-minute / hourly version | Every-minute version |
|---|---|---|
| How many separate periods allowed trades each day? | 3.6 | 12.6 |
| How long did the middle-length period last? | 45 minutes | 4 minutes |
| What share of periods ended within 30 minutes? | 45.0% | 83.1% |
| What share of days had at least one uninterrupted 3-hour period? | 16.7% | 4.4% |
| What share of the measured time allowed trades? | 55.8% | 55.0% |
For example, 16.7% means roughly 17 out of every 100 measured days had at least one uninterrupted 3-hour period in the 15-minute/hourly version. It does not mean 17% of signals lasted three hours.
The every-minute version allows trades for nearly the same total amount of time, but divides that time into many more short pieces.
Does the direction itself last 3–4 hours?
To answer that, we temporarily ignored momentum and measured how long the EMA direction stayed the same.
Hourly EMA20 direction alone
4 hours 30 minutes
Middle-length observed period with the same direction.
Minute EMA1200 direction alone
4 hours 13 minutes
Middle-length observed period with the same direction.
The two direction calculations agreed during 95.9% of measured minutes. Their labels are similar; the repeated momentum checks are the main source of interruptions in the combined signal.
4. Which calculation causes the interruptions?
We changed only one component at a time. This separates the effect of the EMA calculation from the effect of updating momentum every minute.
| Direction calculation | When momentum is updated | Periods per day | Middle-length period |
|---|---|---|---|
| Hourly EMA20 | Every 15 minutes | 3.6 | 45 minutes |
| Minute EMA1200 | Every 15 minutes | 3.7 | 45 minutes |
| Hourly EMA20 | Every minute | 12.5 | 4 minutes |
| Minute EMA1200 | Every minute | 12.6 | 4 minutes |
Whichever EMA we use, updating momentum every minute produces about 12.5 periods per day. Using completed 15-minute momentum readings produces about 3.6–3.7.
What if we keep the minute calculations but decide only every 15 minutes?
At :00, :15, :30 and :45:
calculate direction using minute EMA1200
calculate momentum using the 60-minute price change
apply the long / short / no-entry rule
hold that decision until the next quarter-hour
This gave 3.7 periods per day and a 45-minute middle-length period, almost the same as Version 1.
Holding the decision also means it can remain unchanged while prices move against it between checks. The test measures fewer interruptions; it does not establish better entries.
5. What does this mean for your filter?
The EMA direction is a reasonable starting candidate for the lasting bias you wanted. In this sample, the middle observed period with one direction was more than four hours for either EMA calculation.
Keep that bias separate from the decision to take a particular trade. While the bias is upward, a negative one-hour momentum reading can pause new longs. When momentum turns positive again, longs become eligible again.
Keep a directional label:
rising EMA → upward bias
falling EMA → downward bias
When an entry setup appears:
check whether momentum agrees with that bias
take the setup only if both agree
For fewer changes in entry permission, the tested 15-minute decision schedule is the stronger fit. Neither tested combination routinely keeps that permission continuously on for 3–4 hours. Any different rule designed to force longer continuous signals would need its own test.
6. Extra checks and exactly how the data was handled
The main findings above come from the original comparison. The checks below help show where the result is consistent and where its limits are.
Did the same pattern appear earlier and later in the sample?
Yes. We split the measured days into two groups in date order and counted periods per day again. The second group begins on 2025-10-30.
| Measured days | 15-minute / hourly version | Every-minute version |
|---|---|---|
| First 171 measured days | 3.6 | 12.8 |
| Last 171 measured days | 3.6 | 12.3 |
This is a consistency check, not a separate live trading test.
What happened when evening and overnight hours were included?
We also examined available, usable minutes from 6:00 p.m. on the previous evening through 4:00 p.m. on the trading date, over 382 days. These are longer observation periods and a different set of usable days, so their daily counts should not be directly compared with the daytime counts.
| Question | 15-minute / hourly version | Every-minute version |
|---|---|---|
| How many separate periods allowed trades each day? | 9.8 | 35.5 |
| How long did the middle-length period last? | 45 minutes | 3 minutes |
| What share of periods ended within 30 minutes? | 44.5% | 83.6% |
| What share of days had at least one uninterrupted 3-hour period? | 33.2% | 10.2% |
| What share of the measured time allowed trades? | 51.8% | 51.5% |
The same pattern appeared: 9.8 periods per extended day versus 35.5, with middle lengths of 45 versus 3 minutes.
We used only minutes when both versions had enough valid history. Missing minutes and day boundaries break a period. Closed market hours are never counted as a continuing signal.
Did requiring two hourly readings make the combined signal last longer?
We tested this separate direction rule for each version:
At each completed hour:
read the proposed EMA direction
if this hour and the previous hour both point up:
set the stored bias to up
else if both point down:
set the stored bias to down
else:
keep the previous stored bias
Start with no bias until two readings agree.
A zero reading breaks the agreement sequence.
Keep using momentum to allow or pause entries.
For the minute EMA, we sampled its direction only at hourly boundaries for this check.
The 15-minute/hourly combination still had a middle-length period of 45 minutes; the every-minute combination had 3 minutes. The extra direction rule did not fix the repeated momentum interruptions. These results are separate from the main table, which does not require two readings.
What is the exact EMA formula?
The exponential moving average is updated using its previous value and the new closing price:
weight = 2 / (length + 1)
new EMA = previous EMA
+ weight × (new close − previous EMA)
Hourly version: length = 20
Minute version: length = 1200
First EMA value = first closing price
after the calculation starts or restarts.
We first waited for 60 complete hourly observations in the hourly version, and 3,600 minute observations in the minute version. Comparing the EMA with its older value requires additional history.
As an extra check, we waited longer: 100 hourly observations and 6,000 minute observations before using the corresponding EMAs. Across 303 measured days, the middle-length combined periods were still 45 minutes and 4 minutes.
The two EMAs are close approximations in time scale, not identical averages. The hourly EMA uses only hourly closes. The minute EMA also responds to closing prices throughout each hour.
Which days were included, and what happened at gaps and contract changes?
The original archive contains 707,321 one-minute rows across 518 session dates. A session date labels one futures trading day, including its preceding evening.
- 485 dates had all 390 one-minute bars during 9:30 a.m.–4:00 p.m. and no source-marked data-quality problem anywhere in that session. The other 33 dates did not meet that requirement.
- Of those 485, 342 also had enough valid history for both filters at every minute we measured. The other 143 were left out of the main comparison.
- We used the same 342 dates for both main versions. Each measured day contains exactly 390 one-minute decision intervals.
The data switches between ES contract months eight times. We restart the calculations when that happens so a difference between contract prices does not become a false trend. We also restart after a missing minute inside a session or an unusable source bar. We do not invent replacement prices.
Normal overnight, weekend and daily maintenance closures do not reset the EMA. For EMA comparisons, “three hourly candles earlier” and “180 minute candles earlier” count observed trading candles, skipping scheduled closures. For momentum, the two closes must actually be exactly 60 clock minutes apart. If that is not possible, momentum is unavailable.
An hourly candle is used only if all 60 minute bars are present; a 15-minute candle needs all 15. Candles are aligned to clock-hour and quarter-hour boundaries.
The 9:29–9:30 minute close supplies the first decision at 9:30. The final measured decision interval is 3:59–4:00 p.m.; the close at 4:00 does not create an extra measured minute.
The source is the two-year Databento export already used in this project. Its prices were not adjusted to remove contract-roll differences, which is why we restart at each contract change. No source data was changed.
What does this test leave unanswered?
It does not establish profit, an entry win rate, an optimal exit, or whether the price travels far enough to pay trading costs. A label can stay upward while price goes sideways. The period lengths in the main tables are also shortened by our 9:30 a.m.–4:00 p.m. measurement window.
We did not search through many indicator lengths to find the best-looking result. The main settings are the ones discussed in the chat. The additional combinations and timing checks are identified above.
The saved calculation files include additional statistics and simple later-price comparisons. Those price comparisons have no complete trade-management rules or costs and are not presented here as strategy returns.
Optional: inspect the measurements and calculation code
The formulas and rules are explained above. These files let a reader go deeper:
- All summarized results
- Daily signal counts with descriptive column names
- Portable calculation code
- Input requirements and reproduction instructions
- Independent calculation checks
Original market-data files and minute-by-minute vendor prices are not redistributed. Reproducing the full study requires obtaining the described licensed input. The public GitHub link will be attached before publication.
Study dates, sample and method
- Data period
- Aug 2024 – Aug 2026
- Eligible sample
- 342 complete daytime sessions
- Method
- Completed candles; no future prices