Appearance
Personalize your experience
Order Block Retest
FreeEnters on retests of fresh order blocks
Live engine preview
The QuaScript engine's own output on the chart the terminal uses. Change the settings or edit the code and press Run to recompute it.
About
After a structure break, waits for price to return into the order block that caused it and enters with a limit order at the block's midpoint; the stop sits beyond the block and the target at the swing extreme. Built on the smc libraries.
Settings
Swing legs: 5
Reward (R): 2.5
Measured backtests
Run by the backtest engine on public candles, 2025-11-01 to 2026-11-01, with the script's own commission and slippage, on BTCUSDT 1h (Binance) and ETHUSDT 1h (Binance). The figures per market are in the Measured backtest panel below. Past results do not predict future returns.
Backtest it yourself
Open it on the backtesting page to run it on any symbol, interval and date range, then use Monte Carlo, optimisation, walk-forward and robustness tests.
Strategy Rules
Entry Conditions
Exit Conditions
Measured backtest
BTCUSDT 1h (Binance), 2025-11-01 to 2026-11-01 · backtest engine, script costs included
10.7%
Return
0.52
Sharpe
-22.1%
Max DD
23.3%
Win Rate
30
Trades
| Market | Trades | Return | Sharpe | Max DD | Win rate | Profit factor |
|---|---|---|---|---|---|---|
| BTCUSDT 1h | 30 | 10.7% | 0.52 | -22.1% | 23.3% | 0.77 |
| ETHUSDT 1h | 6 | -1.9% | -0.74 | -4.3% | 33.3% | 0.66 |
Past results on historical data do not predict future returns.
Source Code
Edit in IDE| 1 | strategy "Order Block Retest" { |
| 2 | overlay = true |
| 3 | capital = 100000 |
| 4 | commission = 0.05 |
| 5 | sizing = risk_percent |
| 6 | size = 0.5 |
| 7 | max_objects = 200 |
| 8 | } |
| 9 | /// After a structure break, waits for price to return into the order block that caused it and |
| 10 | /// enters with a limit order at the block's midpoint; the stop sits beyond the block and the |
| 11 | /// target at the swing extreme. Built on the smc libraries. |
| 12 | use "smc/structure" as st |
| 13 | use "smc/zones" as zn |
| 14 | |
| 15 | legs = param.int(5, title = "Swing legs", min = 2, max = 20) |
| 16 | rr = param.float(2.5, title = "Reward (R)", min = 1, max = 10, step = 0.1) |
| 17 | |
| 18 | (dir, up, down, hh, ll) = st.structure(legs) |
| 19 | (found, ob) = zn.order_block(legs) |
| 20 | a = ta.atr(14) |
| 21 | persist zone = zn.Zone() |
| 22 | persist armed = false |
| 23 | if found and position.size == 0 { |
| 24 | zone := ob |
| 25 | armed := true |
| 26 | draw.zone.create(ob.born, ob.top, bar.index + 30, ob.bottom, color = color.translucent(ob.bullish ? color.sky.500 : color.orange.500, 80), text = "OB") |
| 27 | } |
| 28 | if armed and position.size == 0 { |
| 29 | entry = zone.mid() |
| 30 | risk_px = zone.width() * 0.75 + a * 0.25 |
| 31 | if zone.bullish { |
| 32 | order.limit("L", side.long, entry) |
| 33 | exit.bracket("L exit", entry = "L", stop = zone.bottom - a * 0.25, target = entry + risk_px * rr) |
| 34 | } else { |
| 35 | order.limit("S", side.short, entry) |
| 36 | exit.bracket("S exit", entry = "S", stop = zone.top + a * 0.25, target = entry - risk_px * rr) |
| 37 | } |
| 38 | } |
| 39 | // a mitigated block is no longer tradeable |
| 40 | if armed and zone.mitigated() { |
| 41 | armed := false |
| 42 | order.cancel_all() |
| 43 | } |
| 44 | if position.size != 0 { armed := false } |
| 45 | render.step(armed ? zone.mid() : na, "Pending entry", color = color.amber.400, stroke = style.dashed) |
| 46 | render.mark(up, shape = shape.tag_up, at = anchor.below_bar, color = color.sky.400, text = "BOS") |
| 47 | render.mark(down, shape = shape.tag_down, at = anchor.above_bar, color = color.orange.400, text = "BOS") |
| 48 | |
| 49 |
Reviews
No reviews yet. Be the first to review this listing.