The system buys when DEMA(8) crosses over DEMA(21) and sells short on the opposite cross. Long trades use a 10% stop and 40% target, while short trades use a 5% stop and 10% target, both from the entry price.
Best run of 5. Gold, 4 hours, spread 0.6, from run sweeps:2026-10-12-GOLD-4h-opt.tsv:72.
| Period | Up to 2026-10-12 |
| Instrument | Gold, 4 hours |
| Spread | 0.6 points |
| Starting capital | 1,000,000 |
| Costs | Spread only. Commissions and overnight financing are not included. |
| Bars | Up to 200,000 bars, fewer where the instrument has less history |
| Last tested | 2026-10-12 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| GoldBest run | 4 hours | n/a | 2,613 | 34.86 | 2,184 EUR | -1,206 |
| Silver | Daily | n/a | 1,066 | 32.36 | 36,959 USD | -12,714 |
| DAX 40 | 4 hours | n/a | 2,589 | 35.38 | 10,124 EUR | -6,920 |
| Brent Crude | Daily | n/a | 452 | 35.40 | 8,858 EUR | -6,994 |
| Gold | Daily | n/a | 1,137 | 35.62 | 2,145 EUR | -1,119 |
Charts
The code
// ============================================================== // DEMA Crossover Long And Short // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long & short // Timeframe tested: 4 hours // ============================================================== DEFPARAM CumulateOrders = false emaa = ExponentialAverage[8](close) demaa = 2 * emaa - ExponentialAverage[8](emaa) emab = ExponentialAverage[21](close) demab = 2 * emab - ExponentialAverage[21](emab)
13 more lines: the entry and exit rules.
Setup
Questions
Yes. The code is ProBuilder and runs as an automated ProOrder system. Backtest it on your own account with your own spread and position size before trading it live.
It was tested on 5 market and timeframe combinations. The best run by trade count was Gold, 4 hours, with 2,613 trades.
The best run had a maximum drawdown of 1,206 EUR at the tested position size, against a net result of 2,184 EUR.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.