The strategy buys when the close 21 bars ago is above the close 252 bars ago and sells short when it is below. The opposite condition closes the position and opens one in the other direction.
Best run of 3. Gold, Daily, spread 0.6, from run pf:2026-10-11-GOLD-D.tsv:18.
| Period | Up to 2026-10-11 |
| Instrument | Gold, Daily |
| 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-11 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| GoldBest run | Daily | 2.30 | 310 | 43.23 | 50,900 EUR | -23,902 |
| EUR/USD | Daily | 1.41 | 274 | 41.24 | 7,960 USD | -5,381 |
| GBP/USD | Daily | 1.31 | 391 | 48.34 | 7,637 USD | -5,279 |
Charts
Above 1.0 made money, below 1.0 lost money.
The code
// ============================================================== // Time Series Momentum Long Short // ProRealAlgos Strategy Library | prorealalgos.com // Type: Momentum // Direction: Long & short // Timeframe tested: Daily // ============================================================== DEFPARAM CumulateOrders = false ONCE capital = 10000
24 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 3 market and timeframe combinations. The best run was Gold, Daily, with a profit factor of 2.30 over 310 trades.
The best run had a maximum drawdown of 23,902 EUR at the tested position size, against a net result of 50,900 EUR.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.