EA-1031 · Mean Reversion

EA_AML_1-01

This EA trades based on the Adaptive Market Level (AML) custom indicator, which uses fractal dimension analysis to create an adaptive smoothing line. It opens a buy when the AML value is inside the previous bar's range (between open and close with close > open), and opens a sell when AML is inside the range of a bearish bar. When an opposite signal occurs and use_opposite is enabled, it closes the current position and reverses.

Open the interactive view (equity curve, symbol switch)

Key facts

RiskMedium
Blow-up riskLow
Rating★★☆☆☆
TypeTrading EA
TimeframesH1, H4, D1
IndicatorsAML (Adaptive Market Level)
AuthorAdaptive Market Level

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 the Adaptive Market Level (AML) indicator, which calculates an adaptive smoothing coefficient alpha using fractal dimension analysis, applies exponential smoothing to a weighted price, and updates the AML line when the smoothed value change exceeds a threshold, otherwise holding the previous value. Entry conditions: when no position exists, a buy is opened if the AML value lies between the open and close of the previous bullish bar, and a sell is opened if it lies between the open and close of a bearish bar. Exit conditions rely on hardcoded SL/TP values in points, and when opposite trading is enabled, the current position is closed and reversed upon receiving a contrary signal. Position sizing supports both fixed lots and an adaptive mode that scales lot size proportionally to account balance divided by a maximum drawdown parameter. Money management in adaptive mode calculates lot size as base lots multiplied by account balance divided by max drawdown, with a cap at the symbol's maximum volume. Stop loss and take profit are set after order placement via repeated modification attempts up to N_modify_sltp times with 1-second sleep between retries.

Strengths

  • Uses fractal dimension-based adaptive smoothing, allowing the indicator to automatically adjust sensitivity based on market volatility
  • Supports opposite signal reversal, enabling timely position adjustment when trend direction changes
  • Provides adaptive lot sizing mode that dynamically scales position size based on account balance
  • SL/TP modification includes a retry mechanism with up to 7 attempts, improving modification success rate
  • Trade logic executes only on new bar opening, avoiding redundant per-tick calculations

Weaknesses

  • Supports only single-symbol single-position trading via PositionSelect(Symbol()), cannot handle multiple positions on the same symbol
  • Default TP far exceeds SL (3500 vs 500 points), making TP extremely difficult to reach despite favorable risk-reward ratio on paper
  • SL/TP are set via post-trade modification rather than in the initial order, risking naked positions if modification fails
  • The close() function calls GetLastError() after OrderSend failure but doesn't use the return value, rendering error handling ineffective
  • The Max_drawdown parameter meaning is unclear in adaptive lot mode, and available margin is not considered
  • Lacks basic risk controls such as spread filter, trading session restrictions, or maximum daily loss limits

Possible improvements

  • Set SL/TP directly in the initial order request (MqlTradeRequest sl/tp fields) to avoid naked position risk from modification failures
  • Add spread filter and trading session controls to prevent opening positions during high-spread or low-liquidity periods
  • Switch from PositionSelect to order iteration for position management to support multiple strategies on the same symbol

Risk assessment

Overall risk: Medium

  • SL/TP set via modification after trade; if modification fails, the position has no stop loss protection
  • TP is set at 7x SL, meaning most trades will likely be stopped out rather than reaching take profit
  • No spread filter, potentially leading to unfavorable fills in high-spread environments
  • Error handling in close() is incomplete; OrderSend failure is not properly logged or handled

Evaluation scores

Code quality2.0
Strategy logic3.0
Risk management2.0
Robustness2.0
Innovation3.0
Documentation1.0
Overall2.2

Parameters

ParameterDefaultDescription
Lots0.1Fixed trading lot size
TP3500Take profit in points
SL500Stop loss in points
Slippage45Allowed slippage
magic20120830Order magic number
N_modify_sltp7Max retry attempts for SL/TP modification
use_oppositetrueEnable reverse signal close and reverse position
use_MultplfalseEnable adaptive lot size mode
Max_drawdown1800Max drawdown reference for adaptive lot mode
Fractal70AML indicator fractal period parameter
Lag18AML indicator lag parameter
Shift0AML indicator horizontal shift

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.