Testing Popular Ideas · Lesson 8
The opening-range breakout
The first half hour's high and low, a rule that trades the break, and the 24 versions inside it.
Know the basics? Read the lesson notesThe opening range
Each day in this market is one session (the hours the market is open), 09:30 to 16:00. 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. The opening range is the highest and the lowest price of the session's first minutes. Traders use the first 5, 15 or 30, and draw both prices as lines across the rest of the day.
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; the counts in this lesson show what rules do when there is nothing to find. They cannot show whether opening-range rules work in a real market. Try all three lengths.
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 range's minutes. Dashed: its high and low.
A longer range can only get wider. On this day the 15-minute range is the 5-minute one, 106.23 to 106.55, because the next two bars stayed inside it; the 30-minute range reaches up to 106.61.
How often is the range broken?
The idea behind the opening-range breakout: once the price goes past the range, it keeps going that way, so a rule buys above the range and sells below it. To sell short is to sell first and buy back later, so the trade gains when the price falls. Before testing that, count how often the price goes past the range at all: its base rate, how often something happens anyway, before any rule acts on it. "Goes past" here means a later bar reaches the range's high or its low.
Guess: on how many days in 100 does the price go past the 30-minute range, on either side, before 16:00?
Days on which the price went past the opening range (simulated)
Counted over 1,000 simulated markets. Whole bar: past at least one side. Darker part: past both sides.
On this simulated market, 2,601 of 2,607 days. On 1,000 more simulated markets built the same way, 99.8 days in 100. The price went above the range first on 50.5 days in 100, and below it first on 49.1; on the other 0.2, the first bar to reach the range reached both edges, so which came first is unknown.
Why so often? The range covers half an hour; the rest of the day has six hours to wander past it. A shorter range is passed at least as often, and more often on both sides.
For the precise
Every day of the ten years: 2,607 a market. Across the 1,000 simulated markets: past the 5-minute range on at least one side 100.0 days in 100 (both sides 76.2), the 15-minute 100.0 (59.0), the 30-minute 99.8 (46.6; from 99.5 to 100 in single markets). On 0.2 days in 100 the first bar to reach the 30-minute range reached both edges; for the 5-minute range, on 18.4. A five-minute close beyond the 30-minute range came on 98.9 days in 100.Broken, then what?
A break is close to certain. Does the move keep going? Of the days on which the price went above the 30-minute range first, how many went below it too, later the same day?
A rule that bought at the range's high and got out if the price came back to the range's low would have been taken out on all of those days.
Touch or close beyond
The rule: when the price goes past the range's high, buy; when it goes past the low, sell short. One trade a day at most, on the first break, and out by 16:00.
Two common entries. On a touch, an order (an instruction to trade, see the Orders lesson) waits at each edge of the range and trades the moment a bar reaches it, at the edge. On a close beyond, the rule waits for a five-minute bar to close past the edge and enters at that close. Try both on the same day, with the 30-minute range.
Two entries on one day (simulated)
Shaded: the 30-minute range. Dot: the entry.
On a touch the rule bought at 106.61, the range's high, in the 10:15 bar. The first close beyond came in the 12:00 bar, at 106.72: later, and higher.
Where it gets out
A stop ends a losing trade at a set price. Two common places: the other side of the range, or the range's middle. A target ends a winning trade at a set price; here, twice the range's width beyond the entry. Without a target the trade runs to 16:00, unless the stop comes first. Try both stops and both exits on the touch entry.
Stops and exits on one day (simulated)
Shaded: the 30-minute range. Dot: in. Ring: out. Dotted lines: the stop, and the target when there is one.
With the stop at the middle, 106.42, the trade ended in the next bar, −0.18%. With the stop at the other side, 106.23, it lasted until the 14:05 bar and lost twice as much, −0.36%. The target, 107.37, was never reached that day.
How many versions?
Each different set of choices is a version: the same idea with different settings (the How we test an idea lesson). Range length (5, 15 or 30 minutes), entry, stop, exit: how many versions?
One version against just holding
Start with one exact rule: the 30-minute range, a touch, the stop at the other side, out at 16:00. Call it the baseline version: this lesson's starting point, not anyone's published rule.
It runs from 2015 to 2021 against just holding (the benchmark: buying once, never selling; see the How we test an idea lesson). Each buy and each sale costs 0.1% of the price (the Costs lesson); holding pays that once. Results are in % a year: the steady yearly growth that gives the same total. Holding made 4.4% a year. Where did the baseline version end, after costs?
The baseline version and just holding, 2015–2021, after costs (simulated)
Accounts starting at 100. Orange: the baseline version. Dotted: holding.
It lost 46.9% a year after costs. It traded on 260 days a year, nearly every day, paying 0.1% to buy and 0.1% to sell each time. Each of those days keeps 0.998 of the account; 0.998 multiplied 260 times is 0.59, so costs alone take about 41% of the account a year.
One market is one draw, so run it on 1,000 more.
The baseline version against holding on 1,000 simulated markets
Bars: markets, by the version's % a year minus holding's. Grey: after costs. Orange outline: before costs.
Before costs it beat holding in 36 of the 1,000 simulated markets; after costs, in none. Even before costs it seldom did: holding owns this simulated market's slow rise day and night, while the rule is in the market for part of each day and sells short about half the time.
For the precise
Against holding it averaged −14.1 points a year before costs and −52.3 after, across the 1,000 simulated markets. On the market shown it lost 10.7% a year before costs.Again: these markets have nothing to find, so this shows what the rule does then, not whether it works in a real market.
All 24 versions
Here are all 24 versions on the same simulated market and years, 2015 to 2021. Each bar is a version's % a year minus holding's, in points (a point is 1% a year). Show them, then turn the costs on.
24 versions: each one's lead over holding, 2015–2021 (simulated)
One bar per version, grouped by range length. Above the line: beat holding. Black: the baseline version. Solid orange: the best.
On this market 4 of the 24 beat holding before costs, and none after. The best after costs used the 5-minute range, a touch, the stop at the other side, out at 16:00: −35.7 points a year. The baseline version came 23rd of 24: its place, counting from the version furthest ahead of holding.
On the 1,000 simulated markets, after costs, not one of the 24 beat holding in any market.
For the precise
Before costs, at least one of the 24 beat holding in 316 of the 1,000 simulated markets (2.37 versions on average).Does the best stay best?
Before any version was run, 2022 to 2024 were set aside: years held out, to be used once (the held-out test lesson).
On each of the 1,000 simulated markets we took the best of the 24 on 2015–2021, after costs, and ran it once on 2022–2024. A blind draw, one version taken at random, would be best there in about 42 of 1,000 (1,000 ÷ 24 = 41.7). Guess how often the best stayed best.
The best version's place on 2022–2024, on 1,000 simulated markets, after costs
One bar per place, 1st on the left. Places 1 to 4 are about as tall as each other: four near-twin versions take them in turn. Dashed: a blind draw.
The best stayed best in 260 of the 1,000 simulated markets, against a blind draw's 42. Yet it beat holding on 2022–2024 in none.
Why 260? In all 1,000 markets the best was one of the four versions with the 5-minute range and a touch. They trade on the fewest days, so they pay the least in costs. Which of those four near-twins comes first is close to a draw among four: 1,000 ÷ 4 = 250. It is not skill, and it says nothing about a real market.
For the precise
Those four skip the days when the first bar to reach the range reaches both edges (18.4 days in 100), because the order of the two touches inside one bar is unknown; they traded on 212.7 days a year, the other 20 on 255.3 to 261.0. Before costs, too, their trades did a little better (+0.008% to +0.011% a trade, against −0.022% to −0.004% for the other 20), partly from how the simulation draws a bar's high and low (see the honest notes). With costs left out, the best before costs stayed best, before costs, in 165 of the 1,000 simulated markets; in 813 it was one of the same four.Target or stop first: the gambler's ruin
A stop and a target change how often a trade wins, and by how much. If prices have no pattern in which way they move, the chance of reaching the target before the stop depends only on the two distances: the nearer one comes first more often. This is the gambler's ruin (the chance a gambler reaches a goal before going broke). It equals the break-even win rate of the Expectancy lesson, the win rate (trades won per 100) at which wins and losses cancel, so before costs the average trade is zero wherever the two sit.
- s
- the distance from the entry price to the stop
- g
- the distance from the entry price to the target
- P(target first)
- the chance the price reaches the target before the stop, for prices with no pattern in which way they move, moving in small steps (no jumps past the stop or target), when nothing else ends the trade
On the day you saw, the 5-minute range ran from 106.23 to 106.55, a width of 0.32. A buy on a touch at 106.55 with the stop at the other side, 106.23: s = 0.32. The target is twice the width above: 106.55 + 0.64 = 107.19, so g = 0.64. P = 0.32 ÷ (0.32 + 0.64) = 1 in 3. The average: ⅓ × 0.64 − ⅔ × 0.32 = 0.213 − 0.213 = 0.
Across the 1,000 simulated markets, of this version's trades that reached the target or the stop before 16:00, 34.5 in 100 reached the target first: close to the 1 in 3 the rule gives.
- from any price, an up move is as likely as a down move;
- the price moves in small steps, never jumping past the stop or the target;
- nothing but the stop or the target ends the trade.
The session's close ends trades first. The far target needs more time than the near stop, so the 16:00 close cuts off mostly trades still on their way to the target, and among the rest the stop comes first more often. Across the 1,000 simulated markets, 30-minute range: 41 in 100 of the same rule's trades ended at 16:00, and the target came first in only 22.3 of 100 of the rest. A jump past the stop fills worse (see the Orders lesson); a pattern, or a strong drift (a steady rise or fall), moves P.
A buy at 50.00 has its stop at 49.80 and its target at 50.60, in a market with no pattern. About how many trades in 100 reach the target first?
What this means for your test
- Write the exact rule before you run it.
The range's length; touch or close beyond; the stop; the target or the close; out by 16:00; the costs.
- Count the base rate, then compare with just holding after costs.
In these simulated markets the price went past the 30-minute range on 99.8 days in 100, so the baseline version traded nearly every day, and after costs it trailed holding in all 1,000.
- Count the versions, then hold out years.
24 here. After costs the best of 24 stayed best on held-out years in 260 of 1,000 simulated markets, against about 42 for a blind draw, because it traded least: not a sign the breakout works.
A high win rate
In a market with no pattern, about how many trades in 100 would reach the target first anyway?
Hint: call the target's distance 1, so the stop's is 3. Then use s ÷ (s + g).
Best again
In markets like this lesson's, what is the likeliest reason?
A bigger search
In about how many of the 1,000 would a blind draw be best?
Hint: first multiply the choices to get the number of versions, then divide 1,000 by it.
Lesson done
The opening range is the high and low of a session's first 5, 15 or 30 minutes; a breakout rule buys above it and sells short below it, and its entry, stop and exit made 24 versions here. In these simulated markets the price went past the 30-minute range on 99.8 days in 100, so the rules traded nearly every day. These markets were built so that past prices say nothing about which way the next move goes, so the counts show what these rules produce when there is nothing to find: after costs no version beat just holding in any of the 1,000 simulated markets, and the best of 24 stayed best on held-out years in 260 (a blind draw: about 42) because it traded least. When prices have no pattern, a stop and a target change how often a trade wins, not its average before costs. The counts cannot show whether opening-range rules work in any real market.
Key ideas
- Opening range
- the highest and lowest price of a session's first minutes (often 5, 15 or 30); its length is a choice
- Touch, close beyond
- a bar that reaches the range's edge; a bar whose close is past it. A touch entry fills at the edge, a close entry at that close
- Selling short
- selling first and buying back later; the trade gains when the price falls
- Stop, target
- a set price that ends a losing trade; a set price that ends a winning one
- Base rate
- how often something happens anyway, before any rule acts on it
- Version
- the same idea with different settings; count every one
Formulas
P(target first) = s ÷ (s + g), for prices with no pattern in which way they move, moving in small steps (no jumps past the stop or target), when nothing but the stop or the target ends the trade (the gambler's ruin)