In simple terms
Over the full test, Inside Bar alone returned −15.20% after baseline costs. Adding EMA200 brought the result to −1.48%. The filtered version returned +1.48% with the observed spread alone. The other modeled charges erased that gain.
Contents
Two versions of the same breakout
The first takes qualifying upside and downside breakouts. The second adds the EMA200 direction check. Both use the same pattern, quote checks, position sizing and exits.
Quote history and H4 boundaries
We use 159,116,127 paired HistData quotes from 71 monthly archives. We add 5 hours to the provider’s fixed EST timestamps to obtain UTC. The test runs from 1 January 2021 to 1 October 2026 at 00:00 UTC, with November and December 2020 for warm-up. There are 8,425 eligible H4 candles including warm-up. Eligibility requires quotes in all four H1 intervals, a first quote less than 5 minutes from the H4 open and a last quote within 5 minutes of its end. We omit five ambiguous hours and leave gaps open.
What counts as an Inside Bar?
Use the highs and lows of two adjacent, completed Bid candles. The second high must be below the mother high and its low above the mother low. Equal highs or lows fail this strict definition. The mother range stays fixed while the setup is active.
H_I < H_M ∧ L_I > L_M
The close that confirms the breakout
Watch the next three scheduled H4 closes. A Bid close strictly beyond either mother boundary confirms the direction. Touches and equal closes leave the setup pending. A gap or ineligible candle cancels it. Confirmation or the third unsuccessful close consumes the setup, and that close cannot arm another.
C_B > H_M ⇒ s = +1
C_B < L_M ⇒ s = −1
EMA200 direction filter
Start with the mean of the first 200 eligible Bid closes. Update with a weight of 2/201 on each eligible close. The breakout close must be above EMA200 for a long and below it for a short. Equality blocks entry. If the filter blocks the entry, wait for a new setup.
EMA_t = EMA_(t−1) + (2/201) × (C_t − EMA_(t−1))
One chance to enter
When flat, take the first paired quote of the next H4 bin only if it arrives in under 5 minutes and Bid is still beyond the broken boundary. Cancel if the liquidation side is already through or at the stop. Buy at Ask and sell at Bid with adverse slippage. A skipped confirmation needs a fresh setup.
Stop and position size
A long uses the mother low as stop, a short uses the mother high. D is the initial distance from the modeled fill to the stop. Start each test with 10,000 USD and size for 0.5% of flat equity at D, capped at 1× equity in notional. Gaps and costs can lift the realized loss above that price-risk budget.
D = |P_E − Stop|
Q_GBP = min(0.005 × Equity_USD / D, Equity_USD / P_E)
Tick-based exits
The target is 2D from the fill. From the next tick, Bid triggers a long exit and Ask a short exit, in quote order. Find the earlier of the 48-hour limit from entry and the period end. Exit at the first available quote at or after that time, before checking the stop or target on that tick. Fill at the observed side with adverse slippage. One position at a time.
Target = P_E + s × 2D · s ∈ {+1, −1}
Observed spread and assumed costs
Keep the observed Bid and Ask. The baseline adds 0.35 pip commission and 0.15 pip adverse slippage per fill. The model charges 0.50 pip per rollover unit at 17:00 New York time for positions held through that event. Wednesday counts three units and other weekdays one. Broker rates and holiday adjustments vary.
1 pip = 0.0001 USD/GBP
| Case | Observed spread | Commission | Slippage | Modeled rollover |
|---|---|---|---|---|
| Inside Bar only | 517.64 | 169.93 | 72.83 | 168.32 |
| Inside Bar + EMA200 | 404.69 | 125.28 | 53.69 | 125.50 |
Full-period results
Net profit factor is total gains divided by the absolute total of losses. Drawdown uses estimated liquidation equity at the first and last valid tick of every observed H1 and at the modeled executions. Include the accrued charges and estimated exit costs in each open-position mark.
| Case | Net return | Max. drawdown | Trades | Profit factor |
|---|---|---|---|---|
| Inside Bar only · Full period | −15.20% | 19.87% | 390 | 0.787 |
| Inside Bar + EMA200 · Full period | −1.48% | 9.12% | 266 | 0.969 |
Early and later periods
Reset to 10,000 USD and start flat at each boundary while retaining prior candle history. The split is 1 January 2024 at 00:00 UTC. Later, the plain breakout returned −5.65% and the EMA200 version returned −0.60% after baseline costs.
| Case | Net return | Max. drawdown | Trades | Profit factor |
|---|---|---|---|---|
| Inside Bar only · Early period | −10.12% | 11.15% | 182 | 0.748 |
| Inside Bar + EMA200 · Early period | −0.88% | 5.15% | 123 | 0.964 |
| Inside Bar only · Later period | −5.65% | 10.72% | 208 | 0.837 |
| Inside Bar + EMA200 · Later period | −0.60% | 7.45% | 143 | 0.975 |
Sensitivity to costs
Spread-only preserves actual Bid and Ask and sets other charges to zero. Stress adds 0.50 pip commission and 0.50 pip slippage per fill plus 1.00 pip per rollover unit. The filtered model returned −5.38% under stress.
| Case | Net return | Max. drawdown | Trades | Profit factor |
|---|---|---|---|---|
| Inside Bar only · Observed spread only | −11.39% | 17.31% | 390 | 0.838 |
| Inside Bar + EMA200 · Observed spread only | +1.48% | 8.53% | 266 | 1.031 |
| Inside Bar only · Higher costs | −19.66% | 23.34% | 390 | 0.728 |
| Inside Bar + EMA200 · Higher costs | −5.38% | 9.98% | 266 | 0.891 |
A long and a short on observed candles
These are the first long and short executions of the filtered baseline in the later period. M marks the mother candle, I the inside candle and B the breakout candle. E and X point to the modeled entry and exit, with exact UTC timestamps below. The short exits on Ask while the chart shows Bid candles.
- M · UTC
- I · UTC
- B · UTC
- E · UTC
- X · UTC
- E · USD/GBP
- 1.264125
- X · USD/GBP
- 1.270275
- B · Bid
- 1.264020
- EMA200
- 1.259570
- Stop
- 1.261050
- Target
- 1.270275
- P&L · USD
- +46.91
- M · UTC
- I · UTC
- B · UTC
- E · UTC
- X · UTC
- E · USD/GBP
- 1.261845
- X · USD/GBP
- 1.267625
- B · Bid
- 1.261880
- EMA200
- 1.264615
- Stop
- 1.267610
- Target
- 1.250315
- P&L · USD
- −46.56
How the filter changes the sample
Over the full baseline the plain version closed 390 trades and the EMA200 version closed 266. With one position at a time, passing or skipping a signal can also change which later trades are available. The totals compare complete variants.
Reproduce the test
The JSON contains the frozen rules, archive checksums, data audit, all ten scenarios and two examples. The CSV lists executions from both full baseline runs. A separate calculation reproduced the signals, execution order and ledger, and rebuilt sample H4 candles from the raw ticks.
What the test shows
EMA200 reduced the loss in both historical segments and cut the full-period drawdown. Under these rules, the small positive filtered result with spread alone became a loss after baseline charges. Results depend on the quote feed, entry timing and cost assumptions.
Questions and answers
Can the highs or lows be equal?
No. Both inside-bar boundaries must lie strictly between the mother high and low.
Can a wick confirm the breakout?
Confirmation requires a completed Bid H4 close strictly outside the mother range.
What if the first quote is back inside?
Cancel the entry. A later quote cannot reopen that same confirmation.
What if both exit levels are inside the same H4 candle?
Use the first observed executable-side tick that triggers either level. The model preserves source order for equal timestamps.
Does 0.5% cap the loss?
It sizes the position at the initial stop distance. Costs and an executable quote beyond the stop can increase the loss.
Is the rollover rate historical?
The charges are fixed scenario assumptions. The paired quotes provide the historical spread.
Sources and reproducibility
Copying or republication without attribution and an active link to the original material is prohibited. Usage policy.
Risk disclosure
This material is educational. Forex positions involve price, execution and margin risk. The simulation describes one historical sample.