STRATEGY LIBRARY

Time-of-day filters for a day trading strategy, from one variable

Contents
Almost every US equity strategy behaves differently before the open, in the first half hour, and in the afternoon. Naming the segments once at the top beats repeating time comparisons — and it makes the time-of-day assumptions visible instead of scattered.

1. The rule

# BUY — the same idea, different thresholds per segment t = HhmmSs if 40000 <= t and t < 93000: if RisingStreak(2) and Price / HighestPrice(300) - 1 > -0.005: Buy() elif 93000 <= t and t < 100000: if Strength > 130 and TradeAmount > AvgTradeAmount(300) * 3: Buy() elif 100000 <= t and t < 154500: if Strength > 115 and TradeAmount > AvgTradeAmount(300) * 2: Buy()# SELL if HhmmSs >= 155000: Sell() elif ProfitPct >= 1.5 or ProfitPct <= -0.8 or HoldTime >= 1200: Sell()

2. Three segments, three different markets

SegmentClockWhat the thresholds assume
pre-market04:00 – 09:30thin, so structure matters more than size
first half hour09:30 – 10:00fast and expensive, so the bar is highest
the rest10:00 – 15:45normal conditions, thresholds relax
HhmmSs is ET as a number, so 93000 is 09:30:00 and comparisons work as you would expect. Note that the first thirty minutes carry a stricter requirement than the rest of the day. That is not tuning. The opening half hour behaves differently enough that the same threshold means a different thing there, and pretending otherwise is how a strategy ends up working only in backtests weighted toward one part of the day.

3. Why the segments are not arbitrary

We measured this rather than assumed it. The opening thirty minutes is the window where the typical minute most reliably covers its own cost — but it is not the only one, and the rate turns back up into the close (the opening 30 minutes is the easiest day trading window). The half-hour boundary also matters for a less pleasant reason: it is where spreads are widest, and where the names your scanner is showing you turn over fastest — half of a 09:35 watchlist is gone by 10:00 (half the stocks on your day trading watchlist).

4. What the round trip asks of it

Session-segmented entry: the exit block drawn to scale, and the break-even win rate before and after measured trading costs
Session-segmented entry: the exit block drawn to scale, and the break-even win rate before and after measured trading costs
The 1.5% target against a 0.8% stop needs 35% on paper and 67% with the measured 0.75% round trip (what day trading a US stock really costs). That number is one reason to segment at all. The round trip is not the same in every segment — it is widest before the open and in the first minutes, narrowest in the afternoon. A single set of thresholds charges you the same bar in all three, which is precisely the assumption this structure exists to remove.

5. What to change first

Add a fourth segment for the last thirty minutes before you touch any threshold. The close behaves differently again, and lumping 15:00 and 15:44 together is the same mistake as lumping 09:31 and 11:00. Then record which segment each of your trades came from, and compare the segments as if they were separate strategies — because they are. How to backtest a day trading strategy on US stocks.

Educational template for research and backtesting. Not investment advice and not a signal service.

Related reading

← All strategy library

Originally published by TraderWe on August 13, 2026. You may quote and link to this page. Republishing the full text without a link back to the original is not permitted.

3 replies

CryptoKarl· Aug 2026 ago
funny reading this as a perps guy since my market never closes, but the point still lands - my fills at 3am look nothing like my fills during US hours and i've never actually coded that in, just vibes. might steal the named-segment thing and split my day into asia/europe/us blocks instead of clock times. one thing the article never really explains though: why the first half hour gets the harshest filter rather than just being skipped entirely. if it's that ugly why trade it at all?
N
NightOwl_Yuki· Aug 2026 ago
yeah i had the same question karl lol. also curious what happens right at a segment boundary - if you're already holding when the clock rolls over does anything change, or does the exit logic just not care?
BacktestBetty· Aug 2026 ago· edited Aug 2026 ago
Two things I'd add from testing this pattern before: 1. Report your stats per segment, not just overall. If the 10:00-15:45 branch takes 80% of the fills, a blended win rate tells you nothing about whether the open branch is even worth keeping. 2. Watch sample size on the premarket branch specifically. Mine ended up with a couple dozen trades over months and I nearly kept a threshold that was pure noise. 3. The moment you find yourself adding a fourth segment because 14:00-15:00 "feels different", stop. Three is defensible, five is a curve fit with extra steps.
Sign in to reply →