The strategy waits for a break of the last swing high or low, then looks for a fair value gap in that move. It buys or sells short when price returns into the gap, with a stop beyond it and a target at 2 ATR.
Best run of 3. Silver, 4 hours, spread 2, from run pf:2026-10-04-SILVER-4h.tsv:3.
| Period | Up to 2026-10-04 |
| Instrument | Silver, 4 hours |
| Spread | 2 points |
| Starting capital | 1,000,000 |
| Costs | Spread only. Commissions and overnight financing are not included. |
| Bars | Up to 200,000 bars, fewer where the instrument has less history |
| Last tested | 2026-10-04 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| SilverBest run | 4 hours | 1.81 | 2,073 | 35.21 | 173,562 USD | -17,838 |
| Dow Jones | 4 hours | n/a | 743 | 39.97 | 13,777 EUR | -6,447 |
| Brent Crude | Daily | n/a | 447 | 41.39 | 12,300 EUR | -5,212 |
Charts
The code
// ============================================================== // Fair Value Gap Break of Structure // ProRealAlgos Strategy Library | prorealalgos.com // Type: Pattern // Direction: Long & short // Timeframe tested: 4 hours // ============================================================== DEFPARAM CumulateOrders = false ONCE lastsh = 0 ONCE hassh = 0 ONCE lastsl = 0 ONCE hassl = 0 ONCE bosupbar = 0 ONCE hasbosup = 0 ONCE bosdnbar = 0 ONCE hasbosdn = 0 ONCE bfvgh = 0 ONCE bfvgl = 0 ONCE bfvgbar = 0 ONCE hasbfvg = 0 ONCE sfvgh = 0 ONCE sfvgl = 0 ONCE sfvgbar = 0 ONCE hassfvg = 0 atrval = AverageTrueRange[14](close)
67 more lines: the entry and exit rules.
Setup
Questions
Yes. The code is ProBuilder and runs as an automated ProOrder system. Backtest it on your own account with your own spread and position size before trading it live.
It was tested on 3 market and timeframe combinations. The best run was Silver, 4 hours, with a profit factor of 1.81 over 2,073 trades.
The best run had a maximum drawdown of 17,838 USD at the tested position size, against a net result of 173,562 USD.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.