MAGrid
MAGrid is a grid trading Expert Advisor that places buy and sell pending orders at fixed price intervals around a moving average center line. It aims to profit from price oscillations within a range by systematically opening and closing grid levels as the market moves back and forth. The EA uses a moving average as the anchor point and builds a symmetric grid of limit orders on both sides.
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 | -5.75% | -5.02% | 6.57% | 144 | 42.70% | — | — | — | — | Same as other EAs |
| GBPUSD | -9.03% | -7.89% | 11.12% | 144 | 42.70% | — | — | — | — | Same as other EAs |
| USDJPY | -3.05% | -2.65% | 6.28% | 144 | 46.90% | — | — | — | — | Same as other EAs |
| XAUUSD | -100.00% | -100.00% | 100.00% | 37 | 37.80% | — | — | — | — | Same as other EAs |
On every market this backtest is identical to EA-21439. The automatic conversion almost certainly lost what makes this EA different (a custom indicator, a filter or the money management), so these results are not ranked or counted.
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: Elevated
- Opens a grid of orders at fixed price steps
- Can hold up to 10 positions at once
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 concept of MAGrid is using a moving average as the central anchor point and placing symmetric buy and sell limit orders at fixed intervals above and below it, forming a structured trading grid. Entry conditions are triggered when price reaches a grid level, causing the corresponding pending order to be filled — buy orders below the MA and sell orders above it. Exit conditions typically involve closing positions when price reverts to the center line or when a configured take-profit target per level is reached. Position sizing uses either fixed lots or configurable lot sizes per grid level, with the number of grid layers and spacing both adjustable via input parameters. Money management is critical since the grid can hold multiple simultaneous positions, requiring sufficient margin to cover all filled orders or risking a margin call. The strategy performs well in ranging markets but can suffer significant drawdowns in strong trending conditions where one side of the grid fills completely with accumulating unrealized losses.
Strengths
- Consistently profits in ranging markets by capturing small gains from price mean-reversion movements
- Highly configurable parameters allow grid spacing, levels, and lot sizes to be adapted to different instruments
- Clear and logical strategy with systematic execution reducing emotional trading decisions
- Dynamic MA center line adapts better to market trend shifts compared to fixed-price grids
Weaknesses
- Sustained trending markets fill one side of the grid completely, causing mounting unrealized losses and potential margin calls
- Zero stop-loss setting means each level has no protection, making losses unbounded during extreme market moves
- Too many grid levels consume excessive margin, leading to poor capital efficiency and concentrated risk
- Lacks trend filtering — continues placing counter-trend orders during strong directional moves
Possible improvements
- Add a trend filter (e.g., ADX or higher-timeframe MA direction) to pause counter-trend grid placement during strong trending conditions
- Implement account-level risk controls including maximum floating loss limits and total position size caps to prevent margin calls in extreme scenarios
Risk assessment
Overall risk: High risk
- Grid strategy faces unlimited drawdown on one side during trending markets; absence of holistic risk controls can lead to account blow-up
- Default stop-loss of zero means each grid level has no protection, risking catastrophic losses during black swan events
- Multiple simultaneous positions consume significant margin; poor capital management easily triggers forced liquidation
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
GridStep | 20 | Grid spacing in points |
GridLevels | 5 | Grid layers |
LotSize | 0.01 | Default trading lot size |
MAPeriod | 50 | Moving average period |
MAMethod | MODE_SMA | Moving average calculation method |
TakeProfit | 10 | Take profit in points per level |
StopLoss | 0 | Stop loss in points per level, 0 for none |
MagicNumber | 12345 | EA magic number for order identification |
MaxSpread | 30 | Maximum allowed spread |
Similar Grid EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.