Loki DCA v3.0A
A DCA bot for gold on M5 where every basket has a preset stop loss. When a long trend refuses to pull back, the bot closes the whole basket at the loss you chose in advance, and the account lives to trade on. Breakout entries, multi-timeframe trend filter. Free, ready to run.
Backtest results
- Symbol
- XAUUSDm
- Timeframe
- M5
- Initial deposit
- $10,000
- Leverage
- 1:2000
- Period
- 01 Jan 2026 – 01 Dec 2026
- Broker
- Exness Technologies Ltd
- Data
- 100% real ticks
- Profit
- +$17,081
- $10,000 → $27,081
- Max DD
- $5,651
- Largest equity drawdown
- Total trades
- 1,032
- Win rate
- 66.6%
Balance after each closed trade · Hover or tap for details
All metrics
- Net profit
- $17,081.37
- Gross profit
- $40,121.45
- Gross loss
- −$23,040.08
- Profit factor
- 1.74
- Expected payoff
- $16.55
- Recovery factor
- 3.02
- Sharpe ratio
- 8.44
- Max equity DD
- $5,650.92
- Max balance DD
- $4,599.01
- Buy trades (won)
- 479 (67.2%)
- Sell trades (won)
- 553 (66.0%)
- Largest win
- $1,783.04
- Largest loss
- −$629.24
- Average win
- $58.40
- Average loss
- −$66.78
- Max consecutive wins
- 28 trades
- Max consecutive losses
- 10 trades (−$3,079.27)
- Average holding time
- 1:04:10
Past results on one specific broker, for reference only. Max DD = largest equity drawdown in the MT5 report (Equity Drawdown Maximal).
Why DCA bots usually die
Run a DCA bot long enough and you will see this. Three months of steady gains, like a salary. Then one day gold runs in a straight line and never looks back. The bot keeps adding, lots keep multiplying, equity keeps sliding, until the broker closes everything for you. Three months of profit gone in one afternoon, plus the deposit.
Loki DCA still adds positions like any DCA bot. The difference is that every basket gets a stop loss the moment the first trade opens. When price hits it, the bot closes the whole basket, takes a loss you already knew about, and waits for the next signal.
How the bot works
- First trade: the bot only enters on a breakout on the trading timeframe (M5 by default), in the same direction as every enabled trend filter (M30 and H1 by default).
- Basket stop loss: when the first trade opens, the bot measures recent price range and multiplies it by SL Multiplier to get the SL price for the whole basket.
- Adding positions: the distance from entry to SL is split evenly by Max orders. Each step price moves against the basket, the bot adds one trade. The bot works out the lot multiplier itself, so that if the whole basket hits SL the total loss equals Money SL.
- Closing: when price comes back far enough for the average price to reach TP, the whole basket closes. If it hits SL instead, the whole basket closes too.
So before the first trade even opens, the bot knows the worst this basket can cost. With Money SL at $3,000, the worst basket loses about $3,000 plus a little slippage. No more holding until the account is gone.
What the backtest says
The default inputs in the bot are the exact ones used for the backtest on this page: XAUUSDm on M5 at Exness, 1 Jan to 1 Dec 2026, $10,000 deposit, 100% real ticks.
Over the period the bot ran roughly 360 baskets. 6 were stopped out, the heaviest losing $3,079, right around the $3,000 Money SL plus slippage. Six stop-outs, and the account still finished $17,081 up, because the other baskets kept closing in profit and paid for them.
If every month is green, you are looking at an advert. 8 of 11 months were profitable. June and October each took a stop-out and ended about $700 and $1,000 down, November slipped under $100. The deepest equity drawdown was $5,650, about 27% of the account.
Download and run
The .ex5 file ships with the exact inputs from the backtest. Attach it to an XAUUSD M5 chart and it runs, no .set file needed.
The backtest settings were run on a $10,000 account and are for reference only. If you want to change any input to fit your own balance, backtest it and run it on demo first, then decide on real money.
Risk: a per-basket stop keeps the account alive through long trends, but every stop-out is a big loss. Three or four bad baskets in a row will still cut deep, enough to cost you a few nights of sleep. Run it on demo for a few weeks on your own broker before going live.
The bot is free. Anyone selling it to you is running a scam.
Before you run it: allow WebRequest
The bot needs internet access to run. Do this once in MT5:
- Tools menu → Options (or press Ctrl + O).
- Open the Expert Advisors tab.
- Tick Allow WebRequest for listed URL.
- Click Add, paste exactly
https://script.google.com/and click OK.
Once the bot is on the chart, watch the blinking dot in the top right corner:
| Dot colour | Meaning |
|---|---|
| Green | Uptrend |
| Red | Downtrend |
| Yellow | Trend unclear, price ranging |
| Grey | Trend filter switched off |
| Magenta | The bot has an error |
If the dot is magenta, check the WebRequest link above. Still magenta? Switch the chart timeframe so the bot restarts, or remove the bot and attach it again.
The bottom left of the chart has 3 buttons: Close Buy closes all the bot’s buys, Close Sell closes all its sells, Close All closes everything.
Inputs
Inputs are grouped exactly as they appear in the MT5 Inputs tab. The “Default” column shows the values built into the bot, which are also the backtest settings.
General
| Input | Default | What it does |
|---|---|---|
| Magic Number | 3412 | ID for the bot’s trades, so it never manages manual trades or another EA’s trades by mistake. Running several charts? Give each one its own number. |
| First lots | 0.01 | Lot size of the first trade in each basket. The bot works out the later lots from this number. |
| Slippage, pips | 5.0 | If slippage exceeds this, the bot cancels the order instead of filling at a bad price during a spike. |
| TF Trade | M5 | Timeframe the bot reads entry signals from and measures range on to set the basket SL. It must be lower than, and different from, the trend filter timeframes below, or the bot will not run. |
Filter
The bot only enters when the signal agrees with every enabled filter. For example, with filters 1 and 2 on and filter 3 off, the M30 and H1 trends must both point the same way as the signal.
| Input | Default | What it does |
|---|---|---|
| Use filter trend 1? | true | Turns on the first trend filter, usually a mid-term timeframe. |
| TF Trend 1 | M30 | Timeframe of the first filter. |
| Use filter trend 2? | true | Turns on the second filter, usually a higher timeframe to confirm the main trend. |
| TF Trend 2 | H1 | Timeframe of the second filter. |
| Use filter trend 3? | false | Adds a third filter. With three timeframes that all have to agree, trades become much rarer and the bot sits idle more, but each entry is pickier. |
| TF Trend 3 | H4 | Timeframe of the third filter. |
Filter timeframes must be higher than TF Trade. For example, trade M5 and filter on M30, H1, H4.
DCA Settings
| Input | Default | What it does |
|---|---|---|
| Max orders | 10 | Maximum trades in one basket, counting the first. The bot uses it to split the distance from entry to SL into even steps and to work out the lot multiplier. |
Change Max orders and the basket’s maximum loss stays at Money SL, the distance to SL stays the same too. What moves is how the bot spreads lots:
- Small Max orders (5 to 10): wide steps, lots grow fast. When price runs far and then pulls back, the last few big trades bring the basket to profit quickly.
- Large Max orders (20 to 30): tight steps, lots grow slowly. In a narrow range the bot collects more trades and more total volume, so each take profit pays more.
SL Settings
| Input | Default | What it does |
|---|---|---|
| SL Multiplier | 2.0 | Multiplied by the measured range to get the basket’s SL distance. A 100-pip range with 2.0 puts SL 200 pips from entry. The higher it is, the further the SL, the bigger the swing the basket can take, and the smaller the added lots. |
| Money SL | 3000 | Maximum loss for one basket, in account currency. The bot sets the lot multiplier so that a full stop-out loses exactly this much. This is the bot’s main brake. The $3,000 default is the value backtested on a $10,000 account. It cannot be 0. |
TP Settings
| Input | Default | What it does |
|---|---|---|
| TP mode | All TP | How the basket’s take profit is set. Fixed TP pips: close when the average price is a fixed number of pips in profit. Pip TP multiplier: TP is the base DCA step times a multiplier, so it adapts to volatility. Money TP multiplier: close when basket profit reaches a fraction of Money SL. All TP: use all three, whichever hits first. |
| Fixed TP pips | 100.0 | Take profit in pips from the basket’s average price. Used when TP mode is Fixed TP pips or All TP. |
| Money TP multiplier | 0.2 | Close the basket when profit reaches Money SL × this value. With Money SL at $3,000 and 0.2, it closes at $600 profit. |
| Pip TP multiplier when trend following | 2.0 | TP multiplier when the trade goes with the trend. A higher value puts TP further away. |
| Pip TP multiplier when counter trend | 1.0 | TP multiplier when the trade goes against the trend. Set 0 and the bot ignores this case and uses the trend-following multiplier. |
| Pip TP multiplier when trend undefined | 1.5 | TP multiplier when the trend is unclear. Set 0 and the bot ignores this case. |
Daily target
When a daily target is hit, the bot closes everything and stops for the rest of the day. The count restarts each new day. All four are off by default.
| Input | Default | What it does |
|---|---|---|
| Daily money TP target, +$ | 0 (off) | Stop for the day once daily profit reaches this amount. |
| Daily money SL target, -$ | 0 (off) | Stop for the day once daily loss reaches this amount. Enter a negative number, e.g. -500. |
| Daily percentage TP target, +% | 0 (off) | Stop once daily profit reaches this % of the start-of-day balance. On $10,000, a setting of 2 stops at $200 profit. |
| Daily percentage SL target, -% | 0 (off) | Stop once daily loss reaches this % of the start-of-day balance. Enter a negative number, e.g. -1. |
Panel
| Input | Default | What it does |
|---|---|---|
| Font size | 8 | Text size of the on-chart info panel. Go bigger on a large screen, smaller on a small laptop. |
Comments
No account needed. Pick a nickname and the site keeps it reserved for you.
Rate this bot
– /10
No ratings yet.
Commenting as Admin
Save your recovery code
No comments yet. Go ahead and open the first trade.
Comments could not be loaded. Try reloading the page in a few minutes.