Skip to content

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.

The two entry models encoded
ModelTriggerStopTarget
Initial ReversalClose through the 25% (long) or 75% (short) quadrant, then a limit back at that lineRange extremeFar side of range — 3R
50DRT FlipDisplacement close through the midpoint, then a limit back at itOne quadrant behindRange extreme — 2R

The part most backtests skip

How I kept it honest

01

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.

02

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.

03

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.

04

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.

05

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

Cumulative R over 555 tradesOptimistic fillsPessimistic fills
0+50+100trade 1trade 555

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.

Results by fill assumption
Fill assumptionTradesWin rateTotal RExpectancy
Optimistic55434.8%+99R+0.179R
Pessimistic55534.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)

Results by entry model
ModelTradesWin rateBreakevenTotal R
50DRT Flip19245.3%33.3%+55.6R
Initial Reversal36328.9%25%+35.4R

By pair (pessimistic)

Results by currency pair
PairTradesWin rateTotal R
EURGBP10537.1%+20.5R
AUDUSD6836.8%+17.5R
USDJPY3839.5%+14.7R
EURUSD7632.9%+9.8R
USDCAD6132.8%+9R
USDCHF7233.3%+8R
GBPUSD5433.3%+6.8R
NZDUSD8132.1%+4.6R

Positive on all 8 pairs under the pessimistic assumption. The edge is not one lucky instrument carrying the rest.

Parameter sensitivity

Total R across the pivot-length sweep
Pivot lengthTradesWin rateTotal RExpectancy
374937.2%+206.9R+0.276R
463037%+169.8R+0.27R
555434.8%+99R+0.179R
649533.5%+66.1R+0.133R
842031.4%+29.5R+0.07R
1035934%+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