DualMA Two-way Grid MT5 EA Source Code

DualMA Two-way Grid MT5 EA Source Code

Pinned Quarterly Featured MT5v6.0

Dual moving-average trend judgment, flexible trend/counter-trend averaging, average TP + trailing stop + partial close + multi-layer risk control. Good for ranging and MA-cross-churn markets.

Views 998 Downloads 212 File 283.8 KB Updated 2026-09-25

Details & Usage Instructions

43acd55c-f82e-4a86-98d4-c19c83f56394.png

A dual-MA two-way grid trading system on MT5.
Many EAs are secondarily developed from this source.

Judges trend direction by 20/60 MAs, auto-opens and averages on golden/dead cross signals.
Supports trend-following and counter-trend averaging; lot and spacing flexibly adjustable.
Built-in average TP, trailing stop, one/total P/L close, partial close, same-day-profit pause — suited to markets alternating range and trend.

Core Features
1. Dual-MA Trend Judgment
Fast 20, slow 60, SMA, close price.
Golden-cross state allows long/add-long; dead-cross state allows short/add-short.
Option to require MA cross state for the first order.

2. Two-way Independent Trading
Long-only, short-only, or both.
First order instant or pending.
Trend-following and counter-trend averaging controlled separately.

3. Flexible Averaging
Lot sequence customizable, then multiplier or fixed increment.
Trend spacing and counter spacing customizable, default 300 micropoints.
Max averaging counts per side customizable, default 100 each.
Max single-order lot limit, default 88.8 lots.

4. Multi-level TP/SL
One-side average TP: by direction average + fixed micropoints, default 500.
One-side average SL: by direction average - fixed micropoints (optional).
One-side trailing stop: starts after 300 micropoint profit; close on 200 micropoint pullback from peak.
One-side total P/L close: by direction total profit/loss amount.
Total P/L close: by account total profit/loss amount.
Balance-% close-all: trigger by % of balance.
Same-day profit pause: after daily cumulative profit hits % of balance, close and pause EA.

5. Partial Close
Enabled after N orders per side (default 5).
Triggered when tail order profit reaches N micropoints (default 30).
Uses part of profitable orders' profit to offset loss orders, optimizing grid structure.
Ratio of profit/loss orders adjustable (default 50%).

6. Risk Protection
Spread filter: no open if spread exceeds set value.
Trading-time limit: supports PC time or platform time.
Pause opening N minutes after a loss close.
Second-scale in/out control: auto-stop EA after N rapid open/close cycles.
Account binding and usage-time authorization.

Control Panel
Buy/Sell at current price
Lot editor: directly input lot
Close all: one-click close-all and stop EA
Close long / close short
Close profit / close loss
Hide info: hide panel
Real-time long/short counts, lots, P/L, average, balance and equity

Suitable Market
Good for ranging markets and MA-cross-churn markets.
Not for strong one-sided, no-pullback extreme markets.

Risk Warning
A dual-MA grid strategy with deep layers and increasing lots, carrying significant drawdown risk.
Set lots, spacing and risk params reasonably; simulate first; no profit guarantee; you bear all gains and losses.

zhutu.jpg

Risk Warning:Resources on this site are for learning, research and technical exchange only, and do not constitute any investment advice. Before running any EA on any account, please do thorough forward-testing on a demo account first; no strategy can guarantee profits.