A disciplined grid-based Expert Advisor for MetaTrader 5. No indicators — pure price-action midpoint signals drive a fixed martingale structure with ATR-scaled spacing, adaptive direction control, and combined basket take profit.
Two independent code paths keep entry signals separate from grid continuation, eliminating the grid-freeze bug found in earlier martingale systems.
Each bar, the EA computes the midpoint of the previous candle's high and low. If price is above the midpoint it signals BUY; below signals SELL. No external indicators required.
When no positions are open, a new L1 trade is placed only when the bar signal matches the allowed direction. The starting lot resets to the base lot after an easy win.
Once a basket is open, additional levels (L2, L3…) are added whenever price moves against the basket by at least ATR × multiplier. This path is unconditional — it runs every bar regardless of the signal.
When a basket reaches the max grid level it is counted as a "hard basket". After a configurable number of hard baskets, the EA flips direction (BUY → SELL or SELL → BUY) and scales the next lot size.
All positions in the basket are closed together when their combined floating profit reaches the target in pips. This aggregates all levels into a single exit event.
An optional emergency stop closes all positions if the account drawdown exceeds a percentage threshold, protecting against extreme adverse market conditions.
All input parameters with their default values and descriptions.
Use the pre-optimized .set files below instead of tuning manually.
| InpBaseLot | 0.01 | Base lot size for the first trade (L1) of each easy basket |
| InpMultiplier | 2.0 | Lot multiplier applied to each successive grid level |
| InpMaxTrades | 10 | Maximum grid levels per basket. Reaching this triggers a hard basket count |
| InpMaxLosses | 3 | Number of hard baskets before the EA flips direction and scales lot size |
| InpATRPeriod | 14 | Period used to calculate the ATR for dynamic grid spacing |
| InpATRMultiplier | 1.5 | Grid step = ATR × this value. Higher = wider levels, less frequent adds |
| InpBasketTP_Pips | 30.0 | Combined basket floating profit target in pips before all positions close |
| InpMaxDrawdownPct | 20.0 | If equity drawdown exceeds this %, the equity guard closes all positions |
| InpUseEquityGuard | false | Enable or disable the emergency equity drawdown protection |
| InpTimeframe | H1 | Timeframe for bar signals and ATR calculation |
| InpMagic | 334455 | Magic number to identify this EA's orders (change if running multiple instances) |
| InpComment | MartV3 | Trade comment prefix attached to each order |
| InpVerboseLog | false | Print detailed per-bar logs to the Experts journal |
| InpChartDisplay | false | Show live status overlay on the chart (disable during optimization) |
Download the pre-optimized .set files for each currency pair.
Load them in MetaTrader 5 via Expert Advisor → Load settings.
* Parameter values shown are defaults. The downloaded .set files contain pair-specific optimized values.
Every trade placed by this EA is independently recorded and verified on Myfxbook. The account runs on a demo environment using the optimized EURUSD settings available for download above — so you can follow the exact same configuration before committing real capital.
No backtests, no simulations. Forward performance, fully auditable. You can inspect every entry, every grid level added, every basket close, and the full drawdown history at any time directly on Myfxbook.
This EA is optimized for raw spread accounts. IC Markets offers some of the tightest spreads in the industry with fast execution — critical for a martingale system where execution speed directly impacts grid levels.
Use the live price widget to monitor your pairs in real time without leaving this page.