The DMI (Directional Movement Index) was created by J. Welles Wilder, the same author who gave traders the RSI, the ATR and the Parabolic SAR. Its rule is simple: if the +DI line crosses above the −DI, buy; if it goes the other way, sell. I tested the classic version on seven markets over 72 months, and six of them ended negative or close to zero. But on gold the idea holds up: if you move it to H4 and add a trend filter, you get a robot that tripled the deposit in six years and made money in two years the optimizer never saw. Below are its results, real trades on the chart and how to download it for free.
- +219.8% in 72 months on gold (GOLD) H4 with 1% risk per trade. Maximum drawdown: 15.9%.
- +77.3% in the forward test (10/2024–09/2026) with a profit factor of 1.82: the robot made money on data it did not see during optimization.
- With 2% risk per trade, the same robot returned +935.2% in 72 months with a 31.0% drawdown.
- In the archive: the robot ready for MetaTrader 5, the parameter file for gold H4 and the instructions. You can get it running in 5 minutes.
📊 Download Wilder’s DMI robot for free

What the robot does
Wilder described the directional movement system in his book “New Concepts in Technical Trading Systems” (1978). He compared each candle with the previous one: if the high rose above the previous high by more than the low fell below the previous low, it counts as upward movement (+DM); otherwise, as downward movement (−DM). Smoothed and divided by the true range, they give two lines: +DI, the strength of the buyers, and −DI, the strength of the sellers. The third line, the ADX, shows whether there is a trend. The robot keeps Wilder’s idea, trading the crossover of +DI and −DI, and changes what got in the way in the historical data:
- Entry: when +DI crosses above −DI (buy) or −DI crosses above +DI (sell) at the close of the H4 candle. The trade is opened at the open of the next candle.
- Strength filter: the ADX must be above 10; the robot skips a completely “dead” market.
- Trend filter: buys only if the candle closed above the 200 EMA, sells only below it. There are no trades against the big trend.
- Stop: 1.5 ATR(14) from the entry. Take profit: 3 stops. If the DI lines cross in the opposite direction first, the robot closes the trade at market.
- DMI period: 7 instead of Wilder’s 14: on H4 the lines react faster to changes in strength.
- Position size: based on a percentage risk of the balance. In the test, 1%; in the parameters you can set your own.
39% of trades close in profit. The rest are small stops or early exits on the opposite crossover, and one winning trade that hits its take profit covers three stops. The result rests on that asymmetry.
What it looks like on the chart
Below are two real trades by the robot in the gold H4 test. Both are from the forward period, which the optimizer did not see: one winner and one loser. At the bottom are +DI 7 (green) and −DI 7 (red); the yellow circle marks the crossover. The yellow line on the price chart is the 200 EMA, the trend filter.

Winning trade. On June 9, 2026, gold was below the 200 EMA, and after a brief pause the −DI rose back above the +DI. The robot sold at 4252.08, with a stop at 4325.31 and a take profit at 4032.40, three times farther than the stop. Two days later, on June 11, the price hit the take profit: +$879.

Losing trade. On September 9, 2026, the price was above the 200 EMA, and the +DI crossed above the −DI. The robot bought at 4381.76, with a stop at 4336.28. But there was no follow-through: the next day gold turned lower and hit the stop: −$273, about 1% of the balance at that moment. The loss is capped in advance, and one take-profit trade covers three stops like this.
To do it manually: open gold on H4, add the standard Average Directional Movement Index indicator with period 7 and a 200 EMA. Buy at the open of the next candle if the +DI closed above the −DI (and on the previous candle it was below), the ADX is above 10 and the candle closed above the 200 EMA. Sells are the mirror image, below the 200 EMA. The stop goes at 1.5 ATR(14) from the entry and the take profit three times farther. If the DI lines cross in the opposite direction before the stop or the take profit is triggered, close by hand.
Robot results: training and forward test
So that I don’t fool myself with overfitting, I split the history into two parts. The parameters are chosen using only 10/2020–09/2024. Then the robot takes its exam on 10/2024–09/2026, data the optimizer did not see. The test: MetaTrader 5 strategy tester, FxPro demo account with its quotes, spreads, commissions and swaps, $10,000 deposit, 1:500 leverage, “1 minute OHLC” mode, 72 months.

| Period (GOLD H4) | Return | Profit factor | Max. drawdown | Trades |
|---|---|---|---|---|
| Training, 10/2020–09/2024 | +74.0% | 1.35 | 15.9% | 510 |
| Forward, 10/2024–09/2026 | +77.3% | 1.82 | 6.6% | 284 |
| All 72 months, 1% risk | +219.8% | 1.56 | 15.9% | 794 |
| All 72 months, 2% risk | +935.2% | 1.57 | 31.0% | 794 |
| Longest pause without a new high | ≈ 12.5 months (05/2023–05/2024) |
The forward test came out even better than the training: the profit factor rose from 1.35 to 1.82. Let me tell you why: in 2025–2026 gold moved in strong waves, first a rally and then a deep pullback, and that is exactly what a trend system needs. Don’t count on it always being like this. What matters is something else: it is not a single lucky combination of numbers. Of 98 profitable parameter sets in training, 90 also made money in the forward test. Neighboring parameters also stay positive: DMI 14 instead of 7, with the same filters, returned +45.0% in the forward test with a profit factor of 1.63, and DMI 7 without the ADX filter, +68.4% with a profit factor of 1.48. In the test, the robot ended positive in every full year from 2021 to 2025 and also in 2026 through September; the weakest were 2023 (+8.2%) and 2024 (+5.2%). Speaking plainly about the money: over 72 months swaps took $2,437 and commissions $464, and all of that is already included in the result.

📊 Download the robot and the parameters for gold H4
Why the “internet” DMI doesn’t work and this robot does
First I ran the system exactly as Wilder describes it: daily chart, DMI 14, buy when +DI crosses above −DI and sell the other way around, the extreme point rule (enter only if in the following candles the price breaks the high or the low of the crossover candle), reversal on the opposite crossover and a protective stop of 2 ATR. Seven markets, 72 months:

| Instrument (D1) | Result | Profit factor | Max. drawdown | Trades |
|---|---|---|---|---|
| GOLD | +12.4% | 1.64 | 10.8% | 46 |
| BITCOIN | −1.1% | 0.98 | 19.3% | 126 |
| GBPUSD | −6.4% | 0.77 | 13.2% | 99 |
| EURUSD | −10.7% | 0.68 | 15.7% | 102 |
| USDJPY | −11.5% | 0.73 | 13.6% | 93 |
| WTI (oil) | −15.2% | 0.44 | 16.2% | 78 |
| USDCHF | −18.5% | 0.49 | 22.0% | 104 |
Six markets out of seven end up negative or close to zero. Only gold gives a positive result, and that is exactly where the robot works. There are three reasons:
- The DI crossovers happen too often. In a range, the +DI and −DI lines intertwine, and the classic version flips from side to side, paying the spread and a small loss every time. In the classic version only 23–37% of trades close in profit.
- There is no filter for the big trend. A crossover against the long-term move is almost always just a pullback. The classic version trades it like any other signal.
- There is no profit target. An “always in the market” system holds the position until the opposite crossover and gives back a notable part of the move while the lines turn.
The robot that works differs in exactly that: the 200 EMA cuts the trades against the trend, the take profit at three stops captures the move while it lasts, and H4 gives more signals than D1. For comparison: Wilder’s classic on the same gold H4 returned only +19.5% in 72 months with a profit factor of 1.17, and in the training years it ended negative (−4.0%). The robot is tuned only for gold H4, and I don’t advise moving it to other markets without your own test.
The risks, plainly
- The robot lives off gold’s trends. It trades both directions, but most of the profit came from buys during the rally: +$18,146 versus +$4,065 from sells. If gold enters a range for a long time, the DI crossovers will be frequent and empty, and the robot will spend months going nowhere.
- Long pauses. The longest pause without a new balance high: about 12.5 months (May 2023 — May 2024). The longest streak: 13 losing trades in a row between the end of December 2023 and January 2024, about −$1,037.
- The forward test fell in a strong market. +77% in two years is the result in a very active gold market. In a quiet market, expect figures closer to the training: around 15% a year.
- 2% risk doubles the drawdown: 31.0% instead of 15.9%. I would start with 0.5–1% and raise the risk only after the robot has worked live for you.
Where to run it
The robot works in MetaTrader 5 with any broker that offers gold (XAUUSD or GOLD). My test was done at FxPro. The other brokers in my ranking also work: RoboForex and Tickmill. Before putting the robot on an account, run it in your broker’s tester: it takes an afternoon and shows you how it behaves with your quotes, spreads and swaps. For it to work continuously, keep the platform on a VPS: the robot checks the signal at the close of each H4 candle, and if the platform is off, the signal is missed.
Download Wilder’s DMI robot for free
The robot is free for clients of the brokers in my ranking:
- Open a MetaTrader 5 account with one of the brokers above (or use the one you already have).
- Go to the Telegram bot with the button and send your account number.
- After verification, the bot sends you the archive: the robot, the parameters for gold H4, Wilder’s classic parameters for your own experiments and the instructions.
📊 Download the robot for free on Telegram
My conclusion
Wilder’s DMI in its classic form is a system that flips too often: on the daily chart, six markets out of seven ended negative or close to zero over six years. If you keep Wilder’s idea, trading the shift in strength between buyers and sellers, but take gold on H4, trade only in the direction of the 200 EMA and take profit with a three-stop take profit, you get a robot that tripled the deposit in 72 months with a 15.9% drawdown, and in two unseen years earned more than in the four training years. Its weakest point is the long pauses: there was a year without a new high. Protect your deposit: start with 0.5–1% risk.
Today I also analyzed Chande’s Aroon, another trend robot for gold H4. They are systems with similar logic, so if you put both on the same account, split the risk between them. Other robots for gold: the Awesome Oscillator, Raschke’s “80-20”, the TTM Squeeze and Heikin-Ashi. Another Wilder system: Parabolic SAR + ADX.
Why 72 months?
The market changes fundamentally every 3–5 years: the participants and the volatility change, and trends give way to ranges. That is why I don’t run 10–20-year tests: they blend different markets into a single average figure. Gold is a good example. Since 2023 it has moved in long, strong waves, and the DI crossovers caught the start of the move again and again. A 10–20-year test would mix this market with years when gold spent a lot of time in a range. You have to choose a strategy for the current market and change it when the market changes, and this also applies to this robot: if gold enters a long range, you have to stop it.
That is why I built my app “Find your strategy”, in the browser or on Telegram. There you can test any idea on up to 72 months of history, and every 2 weeks the app runs tens of thousands of strategies on its own and shows you the ones that work over the last 6, 12 and 36 months. It doesn’t promise profits: it helps you notice in time that the market has changed.
Backtest results on historical data do not guarantee future results.
Sources
- J. Welles Wilder Jr.: “New Concepts in Technical Trading Systems” (Trend Research, 1978), the Directional Movement System, +DI, −DI, ADX and the extreme point rule.
- Description of the Average Directional Movement Index indicator in the MetaTrader 5 help (MetaQuotes).
- Own tests in MetaTrader 5 on the FxPro demo server, November 2026.
Where to trade
These are the brokers and exchanges I use that work with clients from Latin America. Always check that the service is available in your country and start small.
Risk warning: CFDs, Forex and crypto derivatives carry a high risk of losing money due to leverage. This article is not investment advice.


