Price above the 200 period SMA and a positive MACD(12,26,9) histogram put the system long. Below the SMA with a negative histogram, it goes short. Each trade has a 1% stop and a 3% target, and an opposite signal flips the position.
Best run of 16. EUR/USD, 2 min, spread 1, from run pf:2026-09-24-EURUSD-2m.tsv:5.
| Period | Up to 2026-09-25 |
| Instrument | EUR/USD, 2 minutes |
| Spread | 1 points |
| Contracts | 1 |
| 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-09-25 |
| positionSize Contracts per trade | 1 |
| trendPeriod Trend SMA length | 200 |
| macdFast MACD fast length | 12 |
| macdSlow MACD slow length | 26 |
| macdSignalPeriod MACD signal length | 9 |
| stopLossPct Protective stop, percent of entry price | 1 |
| takeProfitPct Profit target, percent of entry price | 3 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| EUR/USDBest run | 2 min | 2.06 | 4,783 | 19.46 | 487,386 USD | -53,806 |
| EUR/USD | 3 min | 1.80 | 4,512 | 19.81 | 320,038 USD | -36,504 |
| EUR/USD | 5 min | 1.43 | 4,253 | 19.89 | 151,962 USD | -34,084 |
| USD/JPY | Daily | 1.28 | 1,032 | 28.29 | 2,702,350 JPY | -382,610 |
| USD/JPY | 30 min | n/a | 3,704 | 21.33 | 352,160 JPY | -343,430 |
| USD/JPY | 10 min | n/a | 3,758 | 20.78 | 319,550 JPY | -190,140 |
| EUR/USD | Daily | n/a | 972 | 27.47 | 107,120 USD | -31,597 |
| EUR/USD | 4 hours | n/a | 1,203 | 24.77 | 58,507 USD | -51,528 |
| Nikkei 225 | Daily | n/a | 2,035 | 27.86 | 38,685 USD | -19,774 |
| GBP/USD | Daily | n/a | 994 | 26.56 | 14,062 USD | -8,831 |
| Nasdaq 100 | 30 min | n/a | 4,432 | 23.04 | 11,399 EUR | -5,084 |
| Gold | 1 hour | n/a | 3,135 | 23.29 | 2,607 EUR | -811 |
| Gold | 4 hours | n/a | 1,597 | 24.17 | 1,824 EUR | -939 |
| Gold | 5 min | n/a | 4,125 | 19.01 | 1,291 EUR | -1,038 |
| Gold | 3 min | n/a | 4,039 | 20.33 | 1,184 EUR | -876 |
| Gold | Daily | n/a | 2,166 | 25.35 | 826 EUR | -810 |
Charts
Above 1.0 made money, below 1.0 lost money.
Longer history
With 996,000 bars available on EUR/USD 2 minutes, net profit fell to USD 257,837 from USD 487,386 in the standard run, because the older data alone lost USD 229,549.
| Bars available | 996,000 |
| Net, standard 200,000-bar run | 487,386.00 USD |
| Net, long run | 257,837.00 USD |
| Net on the older data alone | -229,549.00 USD |
The code
Every file in the library uses the same header, the same section order and the same variable names. The numbers above were produced by the original version before the rewrite, and the rewrite has not yet been compiled in ProRealTime.
// ============================================================ // MACD Trend Day Trader // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long & short // Timeframe tested: 2 minutes // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false // --- Parameters --- positionSize = 1 // contracts per trade trendPeriod = 200 // trend SMA length macdFast = 12 // MACD fast length macdSlow = 26 // MACD slow length macdSignalPeriod = 9 // MACD signal length stopLossPct = 1 // protective stop, percent of entry price takeProfitPct = 3 // profit target, percent of entry price // --- Indicators --- trendMA = Average[trendPeriod](close) macdHistogram = MACD[macdFast, macdSlow, macdSignalPeriod](close)
17 more lines: the entry and exit rules.
Read this first
Questions
Yes. It is fully automated with a fixed stop, a fixed target and reversal on opposite signals.
EUR/USD was strongest: 2 minutes (profit factor 2.06), 3 minutes (1.8) and 5 minutes (1.43). USD/JPY Daily reached 1.28, while Gold showed small profits on every timeframe tested.
On EUR/USD 2 minutes at 1 contract the worst drawdown was 53,806 USD. That is the figure to size against.
The 2 minute EUR/USD chart gave the best result. The longer 996000 bar rerun showed the edge was far weaker in older data, so the timeframe choice is sensitive to the test period.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.