DCA System MT5 EA User Guide
https://www.mql5.com/en/market/product/154836
How It Works
- The EA opens an initial market order in your chosen trade direction.
- If the price moves against the position, the EA places safety orders at defined steps, increasing position size according to your AmountMultiplier and PriceMultiplier settings.
- Each position (initial or safety order) follows the defined Take Profit (TP) and Stop Loss (SL) strategy.
- Once TP or SL is reached, the EA automatically closes positions and resets according to your configuration.
💡 This system is ideal for traders who want a controlled averaging strategy with automatic re-entry, risk management, and flexible TP/SL options.
Input Parameters and User Guide
The inputs are grouped for clarity to help users configure the DCA strategy effectively.
1. Trade Direction
- TradeDirection – Choose the direction for trading:
- BuyOnly – Only long positions
- SellOnly – Only short positions
2. Step Distance Settings
The EA determines the price intervals at which safety orders are placed using two modes:
- StepDistanceMode – Choose the step calculation method:
- PERCENT – Step is a percentage of the initial price (StepPercent)
- PIPS – Step is a fixed number of pips (StepPips)
- StepPercent – Step distance as a percentage of the initial trade price (used if StepDistanceMode = PERCENT)
- StepPips – Step distance in pips (used if StepDistanceMode = PIPS)
Example:
Initial buy at 1.1000, StepDistanceMode = PIPS, StepPips = 50 → first safety order at 1.0950.
StepDistanceMode = PERCENT, StepPercent = 1% → first safety order at 1.0890.
3. Take Profit (TP) Settings
The system can use percentage-based or fixed amount TP:
- TPMode – Determines TP type:
- Percent – TP as a percentage of the entry price
- Amount – TP as a fixed monetary amount per position
- TPPercent – Percentage TP target (used if TPMode = Percent)
- TPAmount – Fixed TP target (used if TPMode = Amount)
Example:
TPMode = Percent, TPPercent = 2 → TP for a 1.1000 buy = 1.1220
TPMode = Amount, TPAmount = $10 → closes trade once $10 profit is reached.
4. Stop Loss (SL) Settings
The system can close trades if losses reach a defined percentage or fixed amount:
- SLMode – Determines SL type:
- SL_Percent – Stop loss based on account percentage
- SL_Amount – Stop loss based on fixed monetary loss
- SLPercent – Percentage of account equity to trigger SL (used if SLMode = SL_Percent)
- SLAmount – Fixed amount to trigger SL (used if SLMode = SL_Amount)
💡 Helps control risk and prevent large drawdowns.
5. Lot Size & Safety Orders
- InitialLot – Lot size of the first order
- SafetyLot – Base lot size of subsequent safety orders
- MaxSafetyOrders – Maximum number of safety orders allowed
- AmountMultiplier – Factor by which lot size increases for each safety order
- PriceMultiplier – Factor by which the step distance increases for each safety order
Example:
InitialLot = 0.01, SafetyLot = 0.01, AmountMultiplier = 1.5 → first safety = 0.01, second safety = 0.015, third safety = 0.0225, etc.
StepMultiplier adjusts the spacing between consecutive safety orders dynamically.
6. Trade Management & Execution
- MagicNumber – Unique identifier to separate trades from other EAs
- Slippage – Maximum allowed slippage in pips when opening trades
- IncludeManualTrades – If true, the EA includes manually opened trades in calculations for averaging and TP/SL
- MasterReset – When true, resets all trades and safety order logic manually
- SafetyOrderDelaySeconds – Delay in seconds between placing consecutive safety orders (prevents broker overload)
💡 These parameters allow smooth execution even in fast-moving markets.
Advantages
✅ Fully automated DCA averaging system
✅ Flexible TP/SL modes (percentage or fixed amount)
✅ Supports Forex, Gold, Crypto, and Indices
✅ Customizable safety order scaling for both lot size and step distance
✅ Max safety orders and delay settings prevent overexposure and broker issues
✅ Includes manual trade management integration
Example Setup
| Parameter | Value | Description |
| TradeDirection | BuyOnly | Only long positions |
| StepDistanceMode | PERCENT | Step distance calculated as % |
| StepPercent | 1.0 | Step = 1% of initial price |
| StepPips | 50 | Step = 50 pips if mode = PIPS |
| TPMode | Percent | Take profit by % |
| TPPercent | 2.0 | 2% TP target |
| TPAmount | 10 | $10 TP target if mode = Amount |
| SLMode | SL_Percent | Stop loss by % |
| SLPercent | 5 | 5% drawdown triggers SL |
| SLAmount | 10 | $10 loss triggers SL if mode = Amount |
| InitialLot | 0.01 | Base lot size |
| SafetyLot | 0.01 | Base safety lot size |
| MaxSafetyOrders | 5 | Maximum safety orders |
| AmountMultiplier | 1.5 | Lot scaling factor |
| PriceMultiplier | 1.5 | Step distance scaling factor |
| MagicNumber | 12345 | Unique identifier |
| Slippage | 3 | Max allowed slippage |
| IncludeManualTrades | false | Include manual trades in calculations |
| MasterReset | false | Manual reset of all positions |
| SafetyOrderDelaySeconds | 0.5 | Delay between safety orders |
Tip for Users
- Start with fewer safety orders on live accounts and test the step distance and multipliers in the Strategy Tester.
- Adjust TP/SL modes according to your risk tolerance.
- Enable IncludeManualTrades if combining automated DCA with manual positions.






