On a day when the close is above the 7-period SMA but the candle is red so far, it buys. When price is below the SMA and the candle is green, it sells short. It is always in the market after the first trade, with calendar filters that skip longs on Thursdays and in January and shorts on Tuesdays and in April.
Best run of 18. EUR/USD, Daily, spread 1, from run pf:2026-09-24-EURUSD-D.tsv:3.
| Period | Up to 2026-09-25 |
| Instrument | EUR/USD, Daily |
| 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 Size per point | 1 |
| maPeriod Moving average the oscillator is measured against | 7 |
| noLongDay No new longs on this day of week (4 = Thursday) | 4 |
| noLongMonth No new longs in this month (1 = January) | 1 |
| noShortDay No new shorts on this day of week (2 = Tuesday) | 2 |
| noShortMonth No new shorts in this month (4 = April) | 4 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| EUR/USDBest run | Daily | 1.49 | 1,050 | 41.71 | 328,432 USD | -47,802 |
| GBP/USD | Daily | 1.27 | 1,108 | 40.16 | 29,657 USD | -5,040 |
| USD/JPY | Daily | n/a | 1,113 | 38.36 | 2,080,130 JPY | -628,300 |
| USD/JPY | 1 min | n/a | 491 | 73.93 | 127,020 JPY | -61,820 |
| EUR/USD | 1 hour | n/a | 4,826 | 56.22 | 62,713 USD | -62,052 |
| EUR/USD | 10 min | n/a | 2,020 | 66.88 | 57,941 USD | -27,877 |
| EUR/USD | 5 min | n/a | 1,327 | 70.46 | 55,064 USD | -50,974 |
| EUR/USD | 3 min | n/a | 973 | 71.63 | 50,869 USD | -27,883 |
| DAX 40 | Daily | n/a | 882 | 38.21 | 13,376 EUR | -7,351 |
| Dow Jones | Daily | n/a | 1,248 | 35.66 | 11,959 EUR | -9,263 |
| US Crude Oil | Daily | n/a | 962 | 40.02 | 11,817 EUR | -8,909 |
| Nasdaq 100 | 3 min | n/a | 1,062 | 73.92 | 10,572 EUR | -4,506 |
| GBP/USD | 4 hours | n/a | 1,658 | 46.86 | 9,457 USD | -8,538 |
| Nasdaq 100 | 1 min | n/a | 574 | 81.71 | 6,677 EUR | -3,815 |
| Nasdaq 100 | 2 min | n/a | 841 | 76.93 | 5,768 EUR | -4,263 |
| DAX 40 | 1 min | n/a | 669 | 80.72 | 3,481 EUR | -3,332 |
| Gold | Daily | n/a | 1,194 | 38.19 | 2,397 EUR | -1,621 |
| FTSE 100 | 1 min | n/a | 635 | 74.96 | 1,251 EUR | -870 |
Charts
Above 1.0 made money, below 1.0 lost money.
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.
// ============================================================ // Pullback Candle MA Filter // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long & short // Timeframe tested: Daily // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false // --- Parameters --- positionSize = 1 // size per point maPeriod = 7 // moving average the oscillator is measured against noLongDay = 4 // no new longs on this day of week (4 = Thursday) noLongMonth = 1 // no new longs in this month (1 = January) noShortDay = 2 // no new shorts on this day of week (2 = Tuesday) noShortMonth = 4 // no new shorts in this month (4 = April) // --- Indicators --- priceMA = Average[maPeriod](close) maOscillator = close - priceMA redDay = (DClose(0) - DOpen(0)) < 0 greenDay = (DClose(0) - DOpen(0)) > 0
15 more lines: the entry and exit rules.
Read this first
Questions
Yes, it is a simple stop-and-reverse system. The code was rewritten after testing and was not compile-checked, so backtest it first.
Every listed run was profitable. GBP/USD daily recorded a profit factor of 1.27 over 1,108 trades, and USD/JPY daily made JPY 2,080,130 in a sweep with a JPY 628,300 drawdown.
The EUR/USD daily best run had a max drawdown of USD 47,802 at position size 1. Your broker's contract value decides the actual exposure.
The rule looks at the colour of today's daily candle, so the daily chart is its natural home and gave the best recorded result.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.