Controlled Martingale
- Experts
- Anddy Cabrera
- Version: 3.80
- Activations: 10
Controlled Martingale
Controlled Martingale EA is a fully automated Expert Advisor for MetaTrader 5. It uses a grid-based martingale approach driven by a pure price-action signal with no indicators. The entry signal is derived from the midpoint of the previous bar's high and low range. Grid spacing is calculated dynamically using the ATR indicator, so the system adapts to current market volatility automatically.
How it works
The EA separates new basket entries from grid continuation into two independent code paths. A new basket opens only when the price signal matches the allowed direction. Once a basket is open, additional levels are added based solely on price distance from the last entry, with no signal requirement. This separation prevents the grid from freezing when market direction changes.
When a basket reaches the maximum number of grid levels, it is recorded as a hard basket. After a configurable number of hard baskets, the EA flips its trading direction and scales the lot size for the next cycle. All positions in the basket close together when their combined floating profit reaches the target in pips.
Features
- No indicators required for the entry signal
- ATR-based grid spacing adapts to market volatility
- Configurable direction flip after consecutive hard baskets
- Combined basket take profit closes all levels at once
- Optional equity guard closes all positions if drawdown exceeds a set percentage
- Optimized and tested on EURUSD, AUDUSD and USDCAD on the H1 timeframe
- Pre-optimized set files are provided for each supported pair in the comments section
Recommended setup
Use a raw spread account with fast execution for best results. A minimum balance of $3000 is recommended to support the full grid depth safely. Start with the default base lot of 0.01 on a demo account to understand the system behavior before trading live. Run the EA on a VPS to ensure uninterrupted operation. Make sure your account has sufficient free margin to support the full grid depth.
Input parameters
Optimized settings files (.set) for EURUSD, AUDUSD and USDCAD are now available for download at copilotstock.com
Grid and lot sizing:
- InpBaseLot (default 0.01) — lot size for the first trade of each new basket
- InpMultiplier (default 2.0) — lot multiplier applied to each successive grid level
- InpMaxTrades (default 10) — maximum number of grid levels per basket
- InpMaxLosses (default 3) — number of hard baskets before the direction flips and lot size scales up
Spacing and take profit:
- InpATRPeriod (default 14) — ATR period used to calculate grid spacing
- InpATRMultiplier (default 1.5) — grid step equals ATR multiplied by this value
- InpBasketTP_Pips (default 30) — combined basket profit target in pips
Risk management:
- InpMaxDrawdownPct (default 20.0) — drawdown percentage that triggers the equity guard
- InpUseEquityGuard (default false) — enables emergency close when drawdown threshold is exceeded
General:
- InpTimeframe (default H1) — timeframe used for bar signals and ATR calculation
- InpMagic (default 334455) — magic number identifying this EA's orders; change when running multiple instances
- InpComment (default MartV3) — comment prefix attached to each order
- InpVerboseLog (default false) — prints detailed per-bar information to the Experts journal
- InpChartDisplay (default false) — shows a live status panel on the chart; disable during optimization
Risk notice
Grid-based martingale systems increase position size as price moves against the basket. This amplifies both potential gains and potential losses. Test thoroughly on a demo account before using live funds. Past results from backtesting and optimization do not guarantee future performance.
