Testing Popular Ideas · Lesson 15
Confluences: stacking conditions
Four conditions from earlier lessons stacked on one breakout rule: 256 versions, fewer trades and a wider error bar with every condition, and what is left of the best win rate on years set aside.
Know the basics? Read the lesson notesConditions that must all agree
Several lessons cover ideas that traders group under "smart money concepts" (SMC): fair value gaps, order blocks, liquidity sweeps, market structure. They spread through free video lectures and are now taught by many educators, each with their own definitions. We code one common reading, show the switches where readings differ, and test that. It is our reading, not anyone's official method.
Traders who use these ideas often wait until several of them point the same way. They call that confluence, and a common claim is that each added condition raises the win rate: the share of trades that end ahead. Here a stacked rule takes a trade only when every condition on its list agrees with it.
The prices in this lesson 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 here show what stacked rules do when there is nothing to find about which way prices go. They cannot show whether confluence works in a real market.
Start with the number of trades. A rule trades on 260 days a year. You add a condition that agrees with about half of its trades, then a second one like it. About how many trades a year are left?
The rule underneath
The rule is the baseline version from the Opening-range breakout lesson, unchanged; call it the plain rule. The opening range is the highest and lowest price from 09:30 to 10:00. After 10:00, if the price reaches the range's high first, the rule buys; if it reaches the low first, it sells short (sells first and buys back later, so the trade gains when the price falls). A stop, a set price that ends a losing trade, sits at the other side of the range; otherwise the trade ends at 16:00. Each buy and each sale costs 0.1% of the price (the Costs lesson), and a trade counts as a win only if it ends ahead after those costs.
On 2 Jan 2017 this lesson's simulated market broke the range's high at 10:15, so the rule bought at 106.42. Did the trade win?
The plain rule on 2 Jan 2017, 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 opening range. Dot: the entry. Ring: the exit.
It lost. The price ended the day at 106.43, one cent above the entry: +0.01% before costs, −0.19% after the 0.2% the trade paid to buy and sell.
On 2015 to 2021 the plain rule traded on 260 days a year on this market, and 31.7 in 100 of its trades won after costs. Across 1,000 simulated markets: 31.0 in 100.
Two conditions read before the day starts
The first two are read from daily bars (one bar a day: its open, high, low and close) of days that have already closed, so they are known before 09:30.
Daily trend (the Higher-timeframe filter lesson): keep a buy only if the trend reads up, a short sale only if it reads down, where "up" is one of three readings: yesterday closed above its own open (its colour), above its 20-day average, or the 10-day average is above the 30-day one.
Market structure (the SMC: market structure lesson): a trend read from turning points. The trend turns up when a day closes above the latest peak (a day whose high tops the 2, 5 or 10 days either side of it: the width) and down when a day closes below the latest trough. Keep a trade only if it goes the trend's way.
The 30 days before 2 Jan 2017 (simulated)
Daily bars: a thin line from low to high, a box from open to close, filled if the day closed below its open, empty if above. Line: the average of the last 20 closes. Orange: yesterday, 30 Dec.
That morning the plain rule bought. Which of two settings keep the buy: the daily trend read by colour, and market structure with width 5?
Two conditions read inside the day
Session window (the Session windows lesson): keep a trade only if it starts inside a window of New York clock time: 10:00–10:30, 10:00–11:00 or 10:00–12:00.
Fair value gap (the SMC: fair value gaps lesson): three five-minute bars in a row where the third bar's low is above the first bar's high, leaving an empty space between them; that is an up gap, and the same upside down is a down gap. Keep a buy only if an up gap finished before the entry (a short sale needs a down gap). Three settings for how big the gap must be: any size, 0.05% or 0.10% of the price.
2 Jan 2017, 09:30 to 11:00 (simulated)
Shaded grey: the opening range. Orange bands: the up gaps that finished before the entry. Dot: the entry.
The buy came at 10:15. Before it, two up gaps finished: one of 0.02% and one of 0.10%. Does the buy pass the strictest settings, the 10:00–10:30 window and a gap of at least 0.10%?
How many versions?
A version is the same idea with different settings (the How we test an idea lesson). Here each of the four conditions is either off or on with one of its three settings, and a version takes the plain rule's trade only on days when all its switched-on conditions agree.
How many versions are there, counting the plain rule itself (all four off)?
Fewer trades, wider error bars
Take one stack and add its conditions one at a time: the daily trend by colour, the 10:00–11:00 window, market structure with width 5, then a gap of at least 0.05%. Call it the baseline stack: this lesson's starting point, not anyone's published rule. It ran on the same 1,000 simulated markets, 2015 to 2021, after costs.
Each column's vertical bar is an error bar: the range that held the middle 95 of its 1,000 win rates. Every market ran the same rule, so the bar shows how far chance moves a win rate. Add the conditions.
The baseline stack, one condition at a time, 2015–2021, after costs (1,000 simulated markets)
Top: the middle 95 of 100 win rates, dot at the overall rate. Bottom: trades a year. Under each column: how many of the 256 versions have that many conditions (for example, 12 of the 256 have one).
From 260 trades a year to 21, and the error bar from 28.7–33.5 to 27.0–42.6: more than three times as wide. The theory card next says why it widens by that much.
The error bar of a win rate
A win rate is an average: count a win as 1 and a loss as 0. Its standard error is how far chance typically moves it from the rate the rule would show over endless trades (the Sampling error and confidence intervals lesson). On a bell curve, the hump-shaped spread of many random results, about 95 in 100 land within 2 standard errors of the middle, so the error bar is the win rate ± 2 standard errors. Fewer trades give a wider bar, by the square root of how many times fewer.
- p
- the win rate as a fraction (35 in 100 = 0.35)
- n
- the number of trades
- SE
- the standard error of the win rate, as a fraction (× 100 for points: 0.01 is one point)
It won 34.9 in 100 of an average of 146.8 trades: p = 0.35, n = 147. 0.35 × 0.65 = 0.2275; ÷ 147 = 0.00155; √0.00155 = 0.039, so SE = 3.9 points and the error bar is ± 7.9 points. Across the 1,000 simulated markets its win rates had a standard deviation (their typical distance from the average) of 3.9 points, and the middle 95 ran 7.8 points either side.
From 1,817 trades to 147 is about 12 times fewer; √12.4 = 3.5, which is why the bar grew more than three times as wide.
- each trade's result doesn't change the next one's;
- the rule's true win rate stays the same through the test;
- the win rate was measured once, as planned, not picked as the best of many.
A search keeps the best of many versions: the one it keeps is the luckiest, and its bar sits too high (the next cards, and the Best of many lesson).
A backtest won 40% of its 96 trades. How wide is its error bar either side, in points?
Hint: work out SE = √(p × (1 − p) ÷ n), turn it into points, then double it.
Pick the best of each stack
Now do what a search does. In each group (no conditions, one, two, three, four) keep the version with the highest win rate on 2015 to 2021, after costs. More conditions give more versions to choose from, each with fewer trades and a wider error bar, so the luckiest one sits further up.
The plain rule won 31.0 in 100. Guess the best four-condition version's win rate, averaged over the 1,000 simulated markets.
The best version of each group: win rate on 2015–2021, after costs (average of 1,000 simulated markets)
One bar per group, by the number of conditions. Dashed: the plain rule.
The best's win rate climbed with every condition: 31.0, 36.9, 39.7, 41.5 and 42.2 in 100. On this lesson's market the best of the 81 four-condition versions won 38 of its 86 trades: 44.2 in 100.
Does the best stay best?
2022 to 2024 were set aside before any version was run: years held out, to be used once (the Held-out test lesson). Each group's best now runs on them.
A second check: take the best of all 256 on 2015–2021 and count how often it is still best on 2022–2024. A blind draw, one version taken at random, would be best there in about 4 of 1,000 markets (1,000 ÷ 256 = 3.9). But versions with few trades swing further, so they land on top more often. A fairer comparison is the version that trades least, chosen in advance without looking at any result: it was best on 2022–2024 in 42 of 1,000.
The best of each group, 2015–2021 and 2022–2024, after costs (average of 1,000 simulated markets)
Orange: the years it was picked on. Grey: the held-out years. Dashed: the plain rule.
Lower. On 2022–2024, after costs, the bests won 31.1, 36.6, 36.8, 36.7 and 36.5 in 100. Everything the second, third and fourth conditions added was gone; the first condition's gain stayed (the next card says why).
The best of all 256 stayed best in 15 of 1,000 simulated markets: more than a blind draw's 4, mostly because it traded little (132 trades on 2015–2021 against the plain rule's 1,817) and nearly always used the 0.10% gap (878 of 1,000), and fewer than the least-trading version's 42. It is not skill, and it says nothing about a real market.
What held up, and why
The single condition with the best win rate after costs was a gap of at least 0.10% in 903 of the 1,000 simulated markets. A gap that big forms only when the price moves fast. Across the 1,000 simulated markets, on 2015 to 2021, its trades moved further than the plain rule's (0.81% against 0.55% on average, before costs) and fewer of them hit the stop (37.4 in 100 against 46.6), so the same 0.2% of costs took a smaller share and more trades ended ahead.
The other conditions don't pick bigger days, and alone they left the win rate after costs at 30.8 to 31.2 in 100. A higher win rate is not a gain: it ignores how big the wins and losses are. On 2015 to 2021, after costs, the plain rule's profit trailed just holding (buying once and never selling, which pays one 0.1% buy) in all 1,000 simulated markets, and the 0.10% gap version's in 997. So the fast-day effect lifted the win rate, not the profit.
Why did the 0.10% gap version's higher win rate repeat on the held-out years?
How many findings would chance give?
Call a version a finding if its win rate on 2015–2021, after costs, is more than 2 standard errors above the plain rule's. With nothing in it, one version does that by chance about 2.3 times in 100: on a bell curve 95.4 in 100 land within 2, so (100 − 95.4) ÷ 2 = 2.3 land above.
For the precise
Leave out the gap condition, and 63 stacked versions remain that barely change the plain rule's win rate. If their luck were separate, chance would give 63 × 2.3 ÷ 100 = 1.4 findings a market. Counted in this simulation: 0.48 a market, fewer because they share many of their trades with the plain rule they are compared with. Of those findings, only 44 in 100 also beat the plain rule's win rate on 2022–2024. Counting the versions with the gap condition too, there were 43 findings a market: the fast-day effect, not a sign of direction.A search tries 300 versions with nothing in them, each judged alone. About how many findings would chance give?
Hint: each one clears the bar by chance 2.3 times in 100.
What this means for your test
- Count the stack's versions before you test it.
Each condition is off or one of its settings, so multiply (1 + settings) across the conditions: 4 × 4 × 4 × 4 = 256 here.
- Put an error bar on every win rate.
± 2 × √(p(1 − p) ÷ n). In these simulated markets four conditions left 21 trades a year and a bar about 8 points either side.
- Judge the best on held-out years, against chance and against holding.
Here the gains from stacking were gone on 2022–2024, the part that stayed came from keeping fast days, and on 2015 to 2021, after costs, the plain rule and the 0.10% gap version both trailed holding in nearly all 1,000 simulated markets.
A filter that held up
What would you check first?
Seventy percent of thirty
How wide is its error bar either side, in points?
Hint: SE = √(p × (1 − p) ÷ n), in points, then double it.
Count the stack
How many versions is that, the plain rule included?
Hint: each condition has its settings plus "off".
Lesson done
A confluence rule takes a trade only when several conditions agree, and every condition and setting is another version: four conditions, each off or one of three settings, made 256. In these simulated markets, built so that past prices say nothing about which way the next move goes, each added condition cut the trades (260 a year for the plain rule, 21 for the four-condition baseline stack) and widened the error bar, and the best win rate after costs on 2015 to 2021 climbed with every condition (31.0 to 42.2 in 100, averaged over 1,000 markets). On the held-out years 2022 to 2024 everything stacking added beyond the first condition was gone; the gain that stayed came from keeping fast-moving days, not from direction. The best of 256 stayed best in 15 of 1,000 (a blind draw: about 4; the least-trading version chosen in advance: 42), mostly because it traded little. The counts cannot show whether confluence works in a real market.
Key ideas
- Confluence
- several conditions that must all agree before a trade is taken; a stacked rule keeps a trade only when every condition on its list agrees
- Version
- the same idea with different settings; every condition and every setting of it makes more, and they multiply
- Standard error, error bar
- how far chance typically moves a measured win rate; the bar is the win rate ± 2 standard errors and widens as trades get fewer
- Finding
- a version whose win rate beats the plain rule's by more than 2 standard errors; one version with nothing in it does so by chance about 2.3 times in 100
Formulas
SE = √(p × (1 − p) ÷ n), error bar = p ± 2 × SE, for n trades with win rate p (as a fraction), when trades don't affect one another, the true win rate stays the same and it is measured once, not picked as the best of many
versions = (1 + s1) × (1 + s2) × …, when each condition is off or one of its s settings