EA-58135 · Mean Reversion

MeanReversion

This EA implements a mean reversion strategy that buys when the current bar's low is the lowest over a configurable lookback period, and sells when the current bar's high is the highest over the same lookback period. Take profit is set at the midpoint between the highest and lowest prices, while stop loss is symmetrically placed on the opposite side. Position sizing is calculated to limit risk per trade to a configurable percentage of account balance.

Open the interactive view (equity curve, symbol switch)

Key facts

RiskMedium
Blow-up riskLow
Rating★★☆☆☆
TypeTrading EA
TimeframesH1, H4, D1
IndicatorsHighest/Lowest (Price Channel)
Author—

Backtest results (H1, about 1 year)

SymbolP&LAnnualMax DDTradesWin rateSharpeRecoveryLosing streakPer tradeStatus
EURUSD0.00%0.00%0.00%0—————Not convertible yet
GBPUSD0.00%0.00%0.00%0—————Not convertible yet
USDJPY0.00%0.00%0.00%0—————Not convertible yet
XAUUSD0.00%0.00%0.00%0—————Not convertible yet

Why this EA never traded: no entry rule survived the conversion.

Converted from MQL5 to Python and run with the same rules for every EA. Positions use MT5 lot sizes (100,000 units per FX lot, 100 oz per gold lot) with 1:100 leverage, one order at a time, and a stop-out below 10% of the starting balance. Sharpe is computed from the equity curve. Results marked as unreliable are shown for completeness only.

Blow-up risk: No blow-up pattern found

None of the usual blow-up patterns were found in the code, and the account was not stopped out in our backtests. That is not a guarantee: any EA can lose money.

High: stopped out in our backtest, or martingale/grid sizing without a stop loss. Elevated: martingale or grid sizing with a stop loss, or several positions at once without a stop loss. What the label means and what we found →

Strategy analysis

The strategy concept is based on mean reversion: buy when price hits the extreme low over the lookback period, expecting reversion to the mean, and sell when price hits the extreme high, expecting a pullback. Entry conditions are that the current bar's low is the lowest among the lookback bars (buy), or the current bar's high is the highest among the lookback bars (sell). Exit conditions set take profit at the midpoint between the highest and lowest prices (the mean), while stop loss is calculated symmetrically as 2*entry_price minus the mean value. Position sizing uses an incremental loop that increases lot size via OrderCalcProfit until the potential loss exceeds risk_per_trade percent of account balance. Money management includes a CheckMoneyForTrade function that verifies sufficient free margin before opening a position. However, the strategy has notable flaws: only one position is allowed at a time (PositionsTotal>0 returns immediately), the symmetric stop loss calculation may be inappropriate in asymmetric volatility markets, and there is no spread filter, new bar check, or signal confirmation mechanism.

Strengths

  • Strategy logic is clean and straightforward, with an intuitive mean reversion concept
  • Position sizing dynamically calculates based on risk percentage, controlling maximum loss per trade
  • Margin check before opening positions prevents trade failures due to insufficient funds
  • Symmetric stop loss and take profit setup provides a theoretical 1:1 risk-reward ratio

Weaknesses

  • Entries only on new lookback-period extremes, causing frequent counter-trend trades during trending markets leading to consecutive losses
  • Symmetric stop loss calculation (2*price - mean) ignores market volatility asymmetry and may produce unreasonable stop levels
  • No new bar check means every tick re-evaluates signals, potentially causing redundant signal processing within the same bar
  • No spread filter, so opening positions during high spreads may result in unfavorable fill prices
  • PositionsTotal>0 check is overly restrictive, preventing same-direction pyramiding or multi-symbol positions

Possible improvements

  • Add a new bar check mechanism (isNewBar pattern) to prevent repeated signal triggers within the same bar
  • Add spread/ATR filter to prevent entries during high volatility or wide spread conditions, and use ATR-based dynamic stop loss instead of symmetric calculation
  • Add a trend filter (e.g., long-term moving average direction) to avoid counter-trend entries during strong trending markets

Risk assessment

Overall risk: Medium

  • No new bar check, potentially triggering signal evaluation multiple times within the same bar
  • Symmetric stop loss calculation ignores market volatility characteristics, possibly resulting in stops that are too wide in low volatility or too tight in high volatility
  • Mean reversion strategy is prone to consecutive losses during trending markets

Evaluation scores

Code quality3.0
Strategy logic2.0
Risk management3.0
Robustness2.0
Innovation1.0
Documentation1.0
Overall2.0

Parameters

ParameterDefaultDescription
lookback200Lookback bar count for determining high and low prices
risk_per_trade1Risk percentage per trade (% of account balance)

Similar Mean Reversion EAs

Backtests are historical simulations and do not guarantee future results. Not financial advice.

Get the weekly Arena report

One email a week: ranking changes, new signals and new research. No spam; unsubscribe any time.