This strategy buys when the MACD(12, 26, 9) value crosses above zero and sells short when it crosses below. A weak ADX(14) filter above 5 is the only other condition. Trades exit at a 70 point target, a 60 point stop or on the opposite signal.
Best run of 3. USD/JPY, 4 hours, spread 1, from run pf:2026-09-24-USDJPY-4h.tsv:1.
| Period | Up to 2026-09-24 |
| Instrument | USD/JPY, 4 hours |
| 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-24 |
| positionSize Contracts per trade | 1 |
| macdFast MACD fast EMA length | 12 |
| macdSlow MACD slow EMA length | 26 |
| macdSignalPeriod MACD signal line length | 9 |
| adxPeriod ADX length | 14 |
| adxThreshold Minimum ADX reading to trade | 5 |
| takeProfitPoints Target in points | 70 |
| stopLossPoints Protective stop in points | 60 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| USD/JPYBest run | 4 hours | 1.14 | 2,724 | 42.55 | 882,830 JPY | -117,945 |
| Silver | Daily | n/a | 1,014 | 38.86 | 12,142 USD | -7,446 |
| Gold | Daily | n/a | 1,097 | 36.19 | 1,349 EUR | -737 |
Charts
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 Zero Cross // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long & short // Timeframe tested: 4 hours // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false // --- Parameters --- positionSize = 1 // contracts per trade macdFast = 12 // MACD fast EMA length macdSlow = 26 // MACD slow EMA length macdSignalPeriod = 9 // MACD signal line length adxPeriod = 14 // ADX length adxThreshold = 5 // minimum ADX reading to trade takeProfitPoints = 70 // target in points stopLossPoints = 60 // protective stop in points // --- Indicators --- macdValue = MACD[macdFast, macdSlow, macdSignalPeriod](close) adxValue = ADX[adxPeriod]
17 more lines: the entry and exit rules.
Read this first
Questions
Yes, it uses a standard MACD, ADX and a fixed stop and target. It still needs a compile check after the rewrite.
USD/JPY 4 hours gave the best result with JPY 882,830 from 2,724 trades. Silver Daily made USD 12,142 and Gold Daily EUR 1,348.9.
Max drawdown on USD/JPY 4 hours was JPY 117,945. On Gold Daily it was EUR 737, so drawdown depends heavily on the instrument's contract value.
MACD zero crosses are slow signals. On 4 hour bars the 70 point target and 60 point stop fit the typical move size better than on very short bars.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.