Loading…

DCA Accumulator EA

RISK WARNING: this EA does not multiply its lot size after a loss the way a martingale system does - every add is the same size - but it still accumulates exposure in one fixed direction purely on a timer, blind to price. If price trends against that direction for the whole schedule, the floating loss grows roughly in proportion to the number of adds already placed, and nothing closes the basket except the take-profit target, the stop-loss cap, or a manual intervention. This EA exists to make that arithmetic visible on a real account's order history, not to be a strategy recommendation. InpIUnderstandTheRisk defaults to false and has to be set true by hand before any add is placed, matching the other risk demonstrations in this catalogue. InpMaxAdds hard-stops the schedule - not the basket - the moment the cap is reached: existing positions stay open under basket management, they simply stop growing. The basket itself is still managed by a percentage take-profit and a percentage stop-loss measured against account balance, both on by default. Because the schedule is read back from this EA's own trade history under its magic number rather than from a variable, restarting the terminal or reattaching the chart does not reset the add count or bypass the cap - the next scheduled add is computed from what has actually happened on the account, not from an in-memory counter. Notes and limitations - Adds have no individual stop-loss or take-profit; risk is managed only at the basket level by the percentage triggers above. - The schedule is derived from existing positions and their deal history under this magic number, so it is per-symbol and per-magic, not a global timer. - A flattened basket resets the add count to zero on the next scan, on both platforms, since no matching position remains open to scan; the schedule then restarts from scratch on this symbol. - Requires AutoTrading enabled and trading permitted at the terminal, account and Expert Advisor level; if trading is disabled the EA logs it and places nothing. - This is a demonstration of a scheduling technique, not a strategy recommendation. There is no claimed edge in the fixed direction chosen. - Neither platform's version computes a money-per-point figure or a hardcoded contract size anywhere - floating and realised P/L are always read directly from broker-native fields (OrderProfit()/OrderSwap() on MQL4, POSITION_PROFIT/POSITION_SWAP plus history-recovered commission on MQL5), never derived from price distance, so there is nothing here that could be wrong on gold, indices or a JPY cross.

Expert advisor · MT4 · v1.0 · Free

About DCA Accumulator EA

DCA Accumulator EA is an expert advisor (trading robot) for MetaTrader 4. It can size trades from your balance and risk percent. It has 14 settings, such as I understand the risk, Direction and Add lots. MQL source code included.

Files in the download: DcaAccumulatorEa.ex4, DcaAccumulatorEa.mq4, DcaAccumulatorEa.txt.

Trading robots can lose money. Check every setting and test on a demo account before using real funds.

Settings

SettingDefaultWhat it does
I understand the riskfalseMust be set true by hand before this EA will place any trade
DirectionDCA_BUYFixed direction accumulated on every scheduled add
Add lots0.01Flat lot size per add - no multiplier, by design
Add interval hours24Hours between scheduled adds
Max adds10Hard cap on total adds for this magic number
Use basket take profittrueClose the whole basket once it reaches the profit target below
Basket take profit percent3.0Basket close trigger, % of account balance in floating profit
Use basket stop losstrueClose the whole basket if floating loss breaches the cap below
Basket stop loss percent8.0Emergency close-all trigger, % of account balance in floating loss
Magic number20260823Magic number for orders opened by this EA
Slippage pips5Slippage tolerance on any market action
Max retries5Attempts per order action before giving up
Retry wait ms500Pause between attempts, milliseconds
Scan interval sec30Seconds between schedule and basket checks

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
  6. Test it first on a demo account or in the Strategy Tester.

Download the PDF guide

Tags: Martingale · Trend · Risk & Lot Size · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria