ZeroLagEA-AIP v0.0.4
ZeroLagEA-AIP is a trend-following Expert Advisor that uses zero-lag moving average indicators to minimize the typical delay of traditional moving averages. It generates entry signals based on zero-lag MA crossovers and trend direction confirmation, aiming to enter trades earlier than conventional MA-based systems. The EA includes adaptive position sizing and risk management features to protect capital while riding trends.
Open the interactive view (equity curve, symbol switch)Key facts
Backtest results (H1, about 1 year)
| Symbol | P&L | Annual | Max DD | Trades | Win rate | Sharpe | Recovery | Losing streak | Per trade | Status |
|---|---|---|---|---|---|---|---|---|---|---|
| EURUSD | +2.99% | +2.59% | 2.23% | 53 | 58.50% | 1.18 | 1.34 | 4 | +$5.63 | Reliable |
| GBPUSD | -1.52% | -1.32% | 4.46% | 59 | 44.10% | -0.38 | -0.34 | 4 | −$2.58 | Reliable |
| USDJPY | +3.28% | +2.84% | 3.73% | 59 | 50.00% | 0.94 | 0.88 | 4 | +$5.92 | Reliable |
| XAUUSD | +11.54% | +9.44% | 41.30% | 57 | 54.40% | 0.46 | 0.28 | 3 | +$20.24 | Reliable |
Profitable on 3 of 4 markets with reliable results.
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.
Against the other Trend Following EAs with a reliable result on the same market: EURUSD: better than 76% of 95 · GBPUSD: better than 33% of 95 · USDJPY: better than 83% of 95 · XAUUSD: better than 61% of 96
Month by month
| Market | Months with a gain | Best month | Worst month |
|---|---|---|---|
| EURUSD | 62% | +1.28% 2026-06 | -0.67% 2026-02 |
| GBPUSD | 46% | +2.29% 2026-06 | -1.94% 2026-10 |
| USDJPY | 62% | +2.56% 2026-09 | -2.14% 2026-03 |
| XAUUSD | 69% | +12.45% 2026-04 | -18.34% 2026-03 |
From the backtest equity curve, sampled about every two days; only reliable results.
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 core strategy concept is trend-following based on crossover signals from zero-lag moving averages. The ZeroLag MA reduces lag by applying error correction to traditional moving averages, producing timelier signals than conventional MAs. Entry conditions typically involve a fast ZeroLag MA crossing above a slow ZeroLag MA for long positions, and vice versa for short positions, with price position relative to the MA serving as trend confirmation. Exit conditions include reverse crossover signals, fixed stop-loss and take-profit levels, or trailing stops that lock in profits as the trend progresses. Position sizing supports both fixed lot sizes and adaptive calculation based on account equity or risk percentage. Money management includes maximum position limits and drawdown control mechanisms to prevent excessive risk exposure. The overall strategy emphasizes early trend entry by minimizing indicator lag to improve signal timeliness.
Strengths
- Zero-lag MA reduces the inherent delay of traditional moving averages, providing more timely entry signals
- Multi-layer risk control including stop-loss, take-profit, and trailing stop mechanisms
- Supports adaptive position sizing that dynamically adjusts lot size based on account equity
Weaknesses
- Zero-lag MA tends to generate frequent false signals in ranging markets, leading to consecutive losses
- Lacks a market regime filter (e.g., ADX or volatility indicator) to distinguish trending from choppy conditions
- Fixed trailing stop parameter does not account for market volatility changes, potentially exiting too early during strong moves
Possible improvements
- Add an ADX or volatility filter to reduce trading frequency in ranging markets and avoid false signals
- Replace fixed trailing stop with an ATR-based dynamic trailing stop to better adapt exit to market volatility changes
- Implement multi-timeframe confirmation, allowing entries only when the higher timeframe trend direction aligns
Risk assessment
Overall risk: Medium
- Lacks market regime filtering, potentially causing frequent entries and consecutive stop-outs in choppy markets
- Fixed-pip stop-loss does not account for volatility differences across instruments, creating cross-symbol applicability risk
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
ZeroLagMA_Fast_Period | 20 | Fast zero-lag MA period |
ZeroLagMA_Slow_Period | 50 | Slow zero-lag MA period |
StopLoss | 300 | Stop loss in points |
TakeProfit | 600 | Take-profit in points (~10 points) |
Lots | 0.1 | Fixed trading lot size |
TrailingStop | 150 | Trailing stop in points; 0 to disable |
MaxPositions | 3 | Maximum simultaneous positions |
MagicNumber | 17114 | EA magic number for order identification |
Similar Trend Following EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.