Testing Popular Ideas · Lesson 10
Session windows (traders call them “killzones”)
Trading only inside set hours: which hours, which clock, how many windows you tried, and the hour daylight saving moves.
Know the basics? Read the lesson notesA window on the clock
Each day in this market is one session (the hours a market is open), 09:30 to 16:00 New York time. Its prices come as five-minute bars: candles, as in the Markets and prices lesson, each holding the open, high, low and close of five minutes, 78 a day. A session window is a fixed stretch of clock time in which a trader trades, or looks for trades, and does nothing outside it. Traders call such windows “killzones”. Where a window starts and ends is a choice: the same idea could be run as 07:00–10:00 or as 07:00–11:00, and each is a different version.
The prices are simulated: made up by a computer, not a real market. These markets were built so that past prices say nothing about which way the next move goes, at any time of day; the size of moves does cluster, in calm and wild spells. So the counts here show what windows do when there is nothing to find. They cannot show whether any window matters in a real market. Drag a one-hour window across one day.
One day, five-minute bars (simulated)
Each bar: a thin line from its low to its high, a box from its open to its close (empty if it closed higher). Shaded: the window.
On this day, 3 July 2017, the 10:00–11:00 window moved +0.15% and the 11:00–12:00 window +0.29%. Each window gives its own number every day; which one you test is a choice.
Busy hours
Over ten years on 1,000 more simulated markets, made by the same generator (the program that makes these prices), we measured each one-hour window's typical move: its average size, up or down. Which window's moves were largest?
Each one-hour window, over 1,000 simulated markets
Top: the typical size of its move, in %. Bottom: the days it rose, in 100. Labels: each window's start.
The generator was built with busier first and last bars. Did the busy hour go up more often? No. Every window rose on 49.8 to 50.3 days in 100 and fell on about 49; on the rest it ended where it started, to the cent. In this simulation the hour decides how far prices move, not which way, so a busy hour has bigger swings, gains and losses alike, not a better edge.
For the precise
Pooled over 1,000 simulated markets × 2,606 days. Typical move (the average of |log(exit ÷ entry)|): 09:30 window 0.349%, 12:00 window 0.242%, 15:00 window 0.300%. The generator shares its slow rise out over the day in proportion to each bar's share of the day's variance; each window's average log move differed from that share by at most 1.91 standard errors (days treated as independent), what chance alone gives across 12 windows.One window against just holding
Take a window of the kind traders quote, 10:00 to 11:00 New York time. The exact rule: every day, buy at 10:00 and sell at 11:00. Each buy and each sale costs 0.1% of the price (the Costs lesson). Compare it with just holding (the How we test an idea lesson): buying once on the first day and never selling, which pays the 0.1% once. Results are in % a year: the steady yearly growth that gives the same total. From 2015 to 2021 holding made 4.4% a year. Where did the window end, after costs?
The 10:00–11:00 window and just holding, 2015–2021, after costs (simulated)
Accounts starting at 100. Orange: the window. Dotted: holding.
It lost 40.4% a year after costs; before costs it made +0.4% a year, because one hour a day holds only a small slice of this market's slow rise. It traded on 261 days a year, every weekday, and each day keeps 0.998 of the account after costs: 0.998 multiplied 261 times is 0.59, so costs alone take about 41% of the account a year. On 1,000 more simulated markets it beat holding after costs in none.
Every window trades every day and pays the same costs, so costs pull every window down alike and never change which comes first. From here on, results are before costs.
How many windows?
Each window is a version: the same idea with different settings (the How we test an idea lesson). Every version you try is one more chance for luck to look like a find. One-hour windows starting on every half hour, the first at 09:30, each ending by the 16:00 close: how many are there?
Pick a window
Here are all 12 windows on this simulated market, 2015 to 2021, before costs. The years 2022 to 2024 were held out: set aside before anything was run, to be used once (the held-out test lesson). A window's place is its rank among the 12, counting from the best. Pick the window you would choose.
12 windows, % a year before costs (simulated)
Grey: 2015–2021. Orange outline, after you pick: 2022–2024.
The best on 2015–2021 was 15:00–16:00, at +3.6% a year; on 2022–2024 it came 3rd. The best on 2022–2024, 14:30–15:30, had come 11th. The two busiest windows, 09:30 and 15:00, are among the three tallest bars in both periods: their bigger moves spread their yearly results wider.
Does the found window stay best?
A window found by looking for the hours where results were good is the best of 12 versions. On each of the 1,000 simulated markets we took the best window on 2015–2021 and ran it once on 2022–2024. A blind draw, one window taken at random, would be best there in about 83 of 1,000 (1,000 ÷ 12 = 83.3). Guess how often the found window stayed best.
The found window's place on 2022–2024, on 1,000 simulated markets
One bar per place, 1st on the left. Dashed: a blind draw.
It stayed best in 90 of the 1,000 simulated markets, against a blind draw's 83: about what chance gives. The bars differ from each other by chance too: a count like these varies by about 9 either way around 83 (√(1,000 × 1/12 × 11/12) ≈ 8.7).
On the years it was picked from, the found window averaged +4.8% a year before costs, against +0.9 for all 12 windows on average. On the held-out years it averaged +1.1, against +1.0. Picking the best of 12 picked the luckiest, and in markets with nothing to find the luck didn't carry over (the Best of many lesson). After costs it beat holding on the held-out years in none of the 1,000.
For the precise
Average held-out place of the found window: 6.43 of 12. It was the 09:30 window in 204 markets and the 15:00 window in 150 (a blind draw: 83 each); those busier windows' results spread wider, so they land at the top more often in any stretch of years. The 09:30 window was best on the held-out years in 188 markets. No market had a tie for first place.An hour off
Data may come stamped in UTC (Coordinated Universal Time), the world's reference clock, which never changes for summer. New York runs 5 hours behind UTC in winter and 4 hours behind under daylight saving time, when clocks go forward an hour: from the second Sunday in March to the first Sunday in November. Those hours behind (or ahead) are a clock's offset. A tester who turns the stamps into New York time by subtracting 5 hours on every date is right in winter and an hour early in summer. Try both dates with each clock.
Which bars a “10:00–11:00” label picks (simulated)
The same bars, labelled by the chosen clock. Shaded: the bars that clock calls 10:00–11:00.
On 3 July the fixed clock labels the 10:00 bar 09:00, and the bars it calls 10:00–11:00 are really 11:00–12:00 New York time. Daylight saving covered 1,700 of the 2,607 trading days (weekdays) in these ten years, 65 in 100: on every one of them the test measured the wrong hour.
Would anyone notice?
The test still runs and still prints a result. On this simulated market the 10:00–11:00 window made +0.4% a year before costs on 2015–2021 with the right clock, and −2.2% with the fixed one. With the right clock it gained, before costs, in 653 of the 1,000 simulated markets: these markets rise slowly, so most windows gain a little before costs. In how many of the 1,000 did the two clocks disagree about whether it gained?
The same window, two clocks, 1,000 simulated markets
Each dot: one market's 2015–2021 result before costs, in % a year. Across: the right clock. Up: the fixed clock. Orange: the two disagree on gain or loss.
In 358 of the 1,000 simulated markets. On 65 days in 100 the two tests measured different hours, and in markets with nothing to find two different hours give partly separate draws. The wrong results look just as ordinary as the right ones.
If an hour did matter in a real market, this mistake would test a different hour on 65 days in 100; this simulation can't say what it would find there. One clue does show: from March to November the fixed clock's first bar reads 08:30, an hour before the session opens.
A clock time needs its offset
A time stamp means nothing without its clock. Local time is UTC plus the place's UTC offset, and where there is daylight saving time the offset changes twice a year. A time zone database (the tz database, which much software uses) holds each place's offsets and the dates they change: look the offset up for each date, never type in one number.
- tUTC
- the time stamped in UTC
- o(d)
- New York's offset on date d: −4 hours from the second Sunday in March to the first Sunday in November (the US rule since 2007), −5 hours otherwise
- tNY
- the New York clock time of the same moment
The 10:00 bar on 3 July 2017 is stamped 14:00 UTC. That date is under daylight saving, so o = −4: 14:00 − 4 = 10:00. A fixed −5 gives 09:00, and the bar it calls 10:00 is stamped 15:00 UTC: 15:00 − 4 = 11:00 New York. On 2 January 2017 the 10:00 bar is stamped 15:00 UTC; o = −5, so both clocks read 10:00.
- the stamps really are UTC;
- the offset is looked up for each date;
- the rules used are the ones in force in those years.
The data is stamped in another clock, such as an exchange's local time or a data provider's own server clock: read the data's notes, and check the first bar's time in January and in July. Before 2007 the US dates were the first Sunday in April to the last Sunday in October. London changes its clocks on other Sundays (the last in March and the last in October), so on 170 of these ten years' 2,607 trading days London was 4 hours ahead of New York, not 5.
A bar is stamped 13:30 UTC on 15 July. What is its New York time?
What this means for your test
- Write the window with its clock.
“10:00–11:00 New York time, the offset looked up for each date”, the clock the data is stamped in, the exact rule and the costs.
- Count every window you tried, then hold out years.
12 here. The best of 12 stayed best on held-out years in 90 of 1,000 simulated markets, against about 83 for a blind draw.
- Check the clock in the data.
Look at the first bar's time in January and in July. In these simulated markets a clock an hour off for most of the year flipped whether the window gained, before costs, in 358 of 1,000.
A bigger search
On 1,000 simulated markets with nothing to find, in about how many would a blind draw be best on the held-out years?
Hint: count the starts for each length (a 30-minute window can start from 09:30 to 15:30), add them up, then divide 1,000 by the total.
A window set in London
At what New York hour does the window start that day?
Hint: 15:00 London that day is 15:00 UTC. Then use tNY = tUTC + o(d).
An odd first bar
What is the likeliest reason for the 08:30 bars?
Lesson done
A session window trades only inside set hours, and each window you try is a version. These simulated markets were built so that past prices say nothing about which way the next move goes, so the counts show what windows do when there is nothing to find: busy hours moved further but rose no more often, and the best of 12 windows on 2015–2021 stayed best on held-out years in 90 of 1,000 simulated markets, against about 83 for a blind draw. A clock time needs its offset for each date: a fixed UTC − 5 tested the wrong hour on 65 days in 100 and flipped whether the window gained, before costs, in 358 of 1,000 simulated markets. The counts cannot show whether any window matters in a real market.
Key ideas
- Session window
- a fixed stretch of clock time in which a rule trades, or looks for trades; its hours and its clock are choices
- Version
- the same idea with different settings; each window tried is one, so count every one
- UTC
- Coordinated Universal Time, the reference clock, with no daylight saving
- UTC offset
- the hours a place's clock is ahead of UTC (negative if behind) on a given date
- Daylight saving time
- clocks forward an hour for part of the year; in New York from the second Sunday in March to the first Sunday in November (since 2007)
- Blind draw
- a version taken at random from N; if all are equally likely to be best, it is best in about 1,000 ÷ N of 1,000 markets, the figure to set beside “stayed best”
Formulas
tNY = tUTC + o(d), with New York's offset o(d) looked up for each date: −4 hours under daylight saving, −5 otherwise (the US rule since 2007)