Case study
Dealing Range Theory: from chart method to measured edge
A discretionary forex method that traders argued about endlessly, because nobody had ever measured it. The job was to turn chart reading into precise, falsifiable rules and find out.
1H bars · 8 major pairs · London / New York · 2023-10-19 to 2026-07-31 · 0.5 pip round-turn cost
What I built
Pine Script v5 indicator and strategy
Marks dealing ranges live on TradingView — origin sweep detection, quadrant levels at 0 / 25 / 50 / 75 / 100, and both entry models with their stops and targets drawn on the chart.
Python backtest engine
The identical rules, implemented independently, so the method could be measured across years and instruments instead of scrolled through by hand — and so the two implementations could be checked against each other.
| Model | Trigger | Stop | Target |
|---|---|---|---|
| Initial Reversal | Close through the 25% (long) or 75% (short) quadrant, then a limit back at that line | Range extreme | Far side of range — 3R |
| 50DRT Flip | Displacement close through the midpoint, then a limit back at it | One quadrant behind | Range extreme — 2R |
The part most backtests skip
How I kept it honest
Pivots respect their own detection lag
A swing high needs N bars on each side to be confirmed, so it cannot be known until N bars after it printed. The engine only makes a pivot visible on the bar it would genuinely have been confirmed on. Getting this wrong is the single most common way a forex backtest invents an edge that never existed.
Ambiguous bars are scored as losses
When one bar’s range covers both the stop and the target, hourly OHLC data cannot tell you which was touched first. The engine always calls it a loss rather than guessing in the strategy’s favour.
Two fill regimes, both reported
The optimistic reading assumes the entry bar cannot stop you out. The pessimistic reading assumes it can. Rather than pick the flattering one, the engine reports both — so the result has somewhere to fail.
Costs charged, not assumed away
0.5 pip round-turn spread and commission is deducted in R at exit on every single trade, winners and losers alike.
Breakeven win rate stated next to actual
A 34.6% win rate is meaningless until you know the payoff it has to clear. Because the two entry models target 3R and 2R, the blended breakeven is 27.4% — not the 33.3% a flat 2:1 system would need. Reporting both together makes the result impossible to spin.
Results
What the numbers came back as
Both series come from the same trade set. The dashed line assumes the entry bar cannot stop you out; the solid line assumes it can. Reporting only the dashed one would have overstated the result by 8.0R. Hypothetical, cost-adjusted, and not a record of live trading.
| Fill assumption | Trades | Win rate | Total R | Expectancy |
|---|---|---|---|---|
| Optimistic | 554 | 34.8% | +99R | +0.179R |
| Pessimistic | 555 | 34.6% | +91R | +0.164R |
The result survives the harsher assumption almost intact — a 8% degradation, not a collapse. That is the single most informative number in the whole study, and it is the number a backtest built to flatter the strategy would never have produced.
By entry model (pessimistic)
| Model | Trades | Win rate | Breakeven | Total R |
|---|---|---|---|---|
| 50DRT Flip | 192 | 45.3% | 33.3% | +55.6R |
| Initial Reversal | 363 | 28.9% | 25% | +35.4R |
By pair (pessimistic)
| Pair | Trades | Win rate | Total R |
|---|---|---|---|
| EURGBP | 105 | 37.1% | +20.5R |
| AUDUSD | 68 | 36.8% | +17.5R |
| USDJPY | 38 | 39.5% | +14.7R |
| EURUSD | 76 | 32.9% | +9.8R |
| USDCAD | 61 | 32.8% | +9R |
| USDCHF | 72 | 33.3% | +8R |
| GBPUSD | 54 | 33.3% | +6.8R |
| NZDUSD | 81 | 32.1% | +4.6R |
Positive on all 8 pairs under the pessimistic assumption. The edge is not one lucky instrument carrying the rest.
Parameter sensitivity
| Pivot length | Trades | Win rate | Total R | Expectancy |
|---|---|---|---|---|
| 3 | 749 | 37.2% | +206.9R | +0.276R |
| 4 | 630 | 37% | +169.8R | +0.27R |
| 5 | 554 | 34.8% | +99R | +0.179R |
| 6 | 495 | 33.5% | +66.1R | +0.133R |
| 8 | 420 | 31.4% | +29.5R | +0.07R |
| 10 | 359 | 34% | +62.8R | +0.175R |
No setting flips the sign. Expectancy decays smoothly as the pivot lengthens rather than spiking at one magic value — the signature of a real effect rather than a curve fit. A strategy that only works at pivot length 5 would show a very different shape.
+91R
Total R, pessimistic
34.6%
Win rate
27.4% needed to break even
8/8
Pairs profitable
8%
Degradation under harsher fills
The section that goes in every report I write
What this does not prove
A client who only sees the good numbers will over-trust them. So this section is not optional and it is not buried in a footnote.
One regime
October 2023 to July 2026 is not every forex market. No walk-forward across regimes was run.
Imperfect data
yfinance gives mid-price bars with no real bid/ask and gaps around rollover. The 0.5 pip cost is an estimate, not a broker fill record.
An incomplete system
Three components of the original method are deliberately unmodelled: SMT divergence, FVG rebalance as an alternative range close, and news avoidance. The discretionary version is not the system that was tested.
In-sample sweep
Parameters were swept on the same data used to score them. That demonstrates robustness, not out-of-sample validity.
No live forward test
Until there is one, this is a hypothesis with good evidence behind it — not a verified edge.
Want this done to your strategy?
Same method, same standard of honesty, your rules. Stack: Python, pandas, NumPy, yfinance, Pine Script v5.
See prices & buy