MeanRevert EA
- Experts
- Ionut-alexandru Margasoiu
- Versione: 1.40
- Attivazioni: 5
MeanRevert EA — Daily SMA Mean Reversion
Overview
MeanRevert EA trades the statistical tendency of price to return toward its Daily SMA after extended deviations. When the D1 close moves more than a configurable percentage away from the SMA, the EA opens a position in the reversion direction and exits when price approaches the mean again — capturing the snapback move.
The EA is designed for index trading (US30, US500, USTEC, DE40) but works on any liquid instrument.
How it works
At each new Daily bar close, MeanRevert measures the deviation between the closing price and the Daily SMA. If deviation exceeds the entry threshold, a pending signal is stored. After a 1h10m guard period (avoiding the illiquid market open), the order is executed at market. The position is held until price returns within the exit threshold of the SMA, at which point it closes with a market order on the next tick.
An optional scale-in allows a second position to be added if price deviates further by a configurable multiplier — averaging into the trade at a more extreme level.
Key features
Daily SMA mean reversion — long, short, or both directions
Configurable entry deviation % and exit proximity %
Optional scale-in entry at EntryDev × multiplier
Percentage-based breakeven and trailing stop
Three risk modes: % of balance, % of fixed base, or fixed lot
Retry logic with exponential backoff for transient broker errors
Fixed-dollar circuit breaker (daily + total drawdown, high-water mark)
Daily SMA drawn on chart at any timeframe including backtest visual mode
Incremental P&L tracking via OnTradeTransaction — no HistorySelect per tick
Full HUD with real-time deviation, signal state, position details, and win rate
Parameters
ParameterDescriptionMA_PeriodDaily SMA periodEntryDevPctEntry threshold % from SMAExitNearPctExit when within % of SMADirectionModeLong only / Short only / BothSL_PercentStop loss % from entry (0 = off)EnableSecondEntryEnable scale-in positionSecondEntryMultiplierScale-in at EntryDev × this valueEnableBreakevenMove SL to entry after trigger %EnableTrailingTrailing stop by % distanceRiskTypeBalance % / Base money % / Fixed lotMaxDailyDrawdownAmountDaily loss limit in $MaxTotalDrawdownAmountTotal loss from peak equity
Recommended settings
Indices (US30, US500, USTEC, DE40): EntryDevPct 2–5%, ExitNearPct 0.3–0.8%, SL_Percent 2–4%, SMA period 50–200. Optimize on OHLC 1M, validate on real ticks.
Requirements
MetaTrader 5 — any broker. Tested on IC Trading and QDM. Minimum recommended balance $1,000 per instance with 1% risk.
