- Strategy
- After a large bullish candle breaks recent highs, it marks the last bearish candle before it as a bullish order block and buys the first return into it; bearish blocks are traded the same way in reverse.
- Risk model
- 1% of balance per trade (configurable), stop-loss beyond the block on every order, one position or pending order per symbol and magic number
What it does
Order Block Retest EA looks for a strong impulse candle and marks the last opposite-coloured candle before it as an order block, a zone where many traders expect price to react if it comes back. The EA trades only the first return into each fresh block, with the stop placed just beyond the block.
You can choose to enter at market once a candle touches the block and closes without breaking it, or to rest a limit order at the block edge as soon as the block forms.
How it works
On each new bar the EA checks the last closed candle:
- Displacement: a bullish candle whose body is at least 1.5 times ATR and which closes above the highs of the previous 3 bars.
- Block: the most recent bearish candle within the 5 bars before it. Its high and low become the block top and bottom. The impulse must have closed above the block top. If the trend filter is on, the close must also be above the 200 EMA.
- Freshness: the block is watched for up to 60 bars. A close below the block bottom invalidates it. The first candle whose low reaches the block top uses it up, whatever happens next.
- Market mode: if that touching candle closes above the block bottom, the EA buys with the stop at the block bottom minus 0.2 ATR and a 2 R target.
- Limit mode: a buy limit is placed at the block top with the same stop and target. It is deleted when the block is invalidated, when it is older than the block lifetime, or when another position is open.
Bearish blocks are the mirror image. Only one bullish and one bearish block are tracked at a time; a newer block replaces the older one.
How to use it
Use the EA on M15 to H4 charts where impulses are clear. Market mode waits for some confirmation and usually gets a worse price; limit mode gets the block edge but also fills when price slices straight through. Raising the displacement multiple filters out weak impulses. Read the Experts tab to see each block the EA marks.
Settings
| Input | Default | What it changes |
|---|---|---|
| Displacement body (x ATR) | 1.5 | Strength of the impulse candle |
| Break bars | 3 | Prior bars the impulse must close beyond |
| Block search bars | 5 | How far back to look for the opposite candle |
| Block max age (bars) | 60 | Lifetime of a block and its limit order |
| Entry mode | Market | Market on rejection close or limit at block edge |
| Stop buffer (x ATR) | 0.2 | Room beyond the block |
| Max stop (x ATR) | 3.0 | Skips very wide blocks |
| Trend EMA | on, 200 | Direction filter |
| Risk % / Fixed lots | 1.0 / 0 | Position sizing |
| Take-profit (R) | 2.0 | Target distance (0 = none) |
| Max spread / hours | 30 points / 7 to 20 | Entry filters |
| Break-even / Trailing | on at 1 R / off | Trade management |
Limitations
Order blocks are an interpretation, not a law of the market, and many blocks fail. Wide blocks create wide stops and therefore small positions. Limit orders can fill outside your trading hours and during news spikes. The rules use closed candles, so nothing repaints, but entries in market mode come one candle after the touch.
Before you run it live
Test both entry modes in the Strategy Tester and on a demo account first. Check that your broker accepts pending orders at the distances the EA uses (stops level) and how spread behaves at your trading hours. Keep risk small while you learn how the EA behaves, and review risk-reward ratio basics before changing the target. Trading carries a substantial risk of loss.

