Gold MultiFunction Grid EA
- Experts
-
Yi Lan Yuan
Independent algorithmic trader and MQL5 developer focused on automated grid systems for XAUUSD (Gold). I build two-way grid strategies with layered trend filters, false-signal repair, pre-trade margin checks and equity-based risk controls, and every system is tracked on a live account.Live results - Versão: 1.11
- Atualizado: 10 novembro 2026
- Ativações: 10
Strategy Logic
- Initial entry: On each new M1 bar, the previous closed bar is evaluated. A bullish bar opens a long seed, a bearish bar opens a short seed.
- Grid averaging: Positions are added in the same direction at configurable distances. Up to 40 levels per direction are supported, each with its own lot size.
- Basket take profit: All positions of one direction share a single take-profit price; when the combined floating profit reaches the USD target for that level count, the basket closes together.
- Configurable sizing: Lot sequences (1-40), profit targets (1-40), a TP cap and an optional high-level loss-exit target are fully adjustable.
Key Features
- Three-tier grid spacing: Separate distances for the second level, middle levels and high levels, with optional denser averaging at high position counts.
- Strong trend protection: Counts consecutive closed bars on one side of a moving average (default 21). When the threshold is reached and counter-trend positions are few (and few counter orders were opened during the trend formation), the EA closes that side and blocks new counter-trend entries for the day. Every condition count is configurable and can be disabled.
- False-signal repair for strong trends:
- Simulation repair: after a strong-trend close, a virtual basket keeps tracking the closed side; if it would have reached its profit target, the trend is treated as a false signal and trading that side is resumed.
- Pullback repair: if price retraces a configurable ratio (default 50%) of the trend range, the block is lifted automatically.
- Triple strong trend filter: Three consecutive oversized bullish/bearish bars trigger the same protective close-and-block logic, with its own per-bar move threshold and position limit.
- Enhanced large-amplitude handling: A large-range bullish or bearish candle body closes and blocks the opposite side (enhanced mode), or clears both lightly-positioned sides and stops trading for the day (classic mode). Repair simulations and pullback thresholds are supported here as well.
- Big candle filter: Blocks counter-trend entries after oversized candles, with optional extra spacing and an optional lot multiplier for the next add.
- High-level MA filter: Above a configurable level, new averages are only allowed on the correct side of the MA, with an optional dynamic lot multiplier.
- ADX trend filter: When ADX exceeds the threshold, trades are only taken in the direction of MA50 versus MA200.
- Risk controls: One-direction floating loss stop (close and restart), high-level negative TP target (accept a small controlled loss at deep levels instead of waiting for profit), per-bar order limit, and TP target cap.
- Progressive lot sizing: Optionally widen the lot difference at higher levels with a configurable factor.
- On-chart control panel: Change the initial lot live, monitor real and simulated baskets, and close longs, shorts or everything with one click. The panel is resizable.
- Restart recovery: Grid anchor prices are rebuilt from existing positions after a restart.
- Self-contained: No DLL calls, no web requests, no file operations, no email, no licensing or time limits.
Input Parameters Overview
- Core: Initial lot, base/second/large/small grid steps and their start levels, magic number, slippage.
- Candle filters: Big candle threshold, extension threshold/add/lot factor, large-amplitude clear threshold with classic/enhanced modes and repair settings.
- Trend filters: Strong-trend bar count, position and counter-order limits, simulation repair and pullback repair ratio, triple-trend enable/threshold/limit, ADX threshold, high-level MA filter with period and lot mode.
- Risk: Floating loss stop amount, TP cap level, high-level TP start and target (supports negative values).
- Sizing: 40 individual grid lots and an optional lot-difference widening level/factor.
- Targets: 40 individual USD take-profit targets.
- Panel: Width and height.
Minimum Requirements & Recommendations
- Symbol: XAUUSD (Gold); the logic is symbol-agnostic but defaults are tuned for Gold.
- Timeframe: M1 (seeding uses M1 bars; filters evaluate the chart timeframe the EA is attached to).
- Initial Lot: For both USD accounts and Cent accounts, if the initial balance is 40000, the default initial lot size is 0.02. If the initial balance is N times of 40000, the initial lot size shall also be N times of 0.02. The initial lot size needs to be manually entered in the panel or properties.
- Account: Please use hedging accounts for full two-way operation.
- Leverage: at least 1:500
-
Spread:XAUUSD (Gold) below 0.3 USD.
- Start on a demo account,, and use a VPS for uninterrupted operation.
Risk Warning
Trading foreign exchange and contracts for difference carries a high level of risk and may not be suitable for all investors. Grid and averaging strategies can accumulate a large number of positions during sustained trends, and leverage can lead to losses, only trade with capital you can afford to lose, and test the Expert Advisor thoroughly on a demo account before using it live.
