MQL5 Algo Trading: post #3978 — TG.ME

This article turns the Oops gap reversal into a rule-complete MQL5 Expert Advisor, removing the common manual errors: missing the gap, confirming too early, letting setups run past validity, and inconsistent risk sizing. The EA detects gap-up and gap-down opens beyond the prior candle’s range, filters by a minimum gap in points, and tracks each setup for a fixed number of bars.

A shared state structure stores the gap bar time, reference levels, and lifecycle counters. Confirmation only happens on a later completed candle closing back into the prior range, preventing repeat signals and avoiding same-bar confirmation.

After confirmation, the EA rebuilds the gap-bar stop using iBarShift, projects take-profit from a risk-reward ratio, and sizes volume via fixed lots or percent-risk using OrderCalcProfit with broker step/limits. Execution is guarded by one-posit...

👉 Read | VPS | @mql5dev
❤24👍8🏆3👀2👾2👌1
August 27, 2026 15.5K 7