The system adds up candle body changes over 978 bars and trades against extremes: it buys when a negative sum makes a new low and sells when a sum above 51 pips makes a new high. Positions only close when the opposite signal flips them.
Best run of 37. S&P 500, 30 min, spread 1, from run pf:2026-09-24-USA500-30m.tsv:3.
| Period | Up to 2026-09-25 |
| Instrument | S&P 500, 30 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 |
| sumPeriod Bars summed | 978 |
| upperFilter Sum must exceed this many pips to count as positive | 51 |
| lowerFilter Sum must be below minus this many pips to count as negative | 0 |
| invertSignal 1 = as tested, -1 flips every signal | 1 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| S&P 500Best run | 30 min | 2.86 | 124 | 60.48 | 6,859 EUR | -1,368 |
| S&P 500 | 1 hour | 1.88 | 226 | 58.85 | 6,349 EUR | -1,457 |
| Gold | Daily | 1.77 | 110 | 63.64 | 3,481 EUR | -893 |
| S&P 500 | 4 hours | 1.62 | 406 | 57.64 | 6,775 EUR | -1,337 |
| Silver | 1 hour | n/a | 1,242 | 55.56 | 1,147,598 USD | -570,335 |
| USD/JPY | 30 min | n/a | 674 | 54.75 | 579,880 JPY | -299,590 |
| USD/JPY | 4 hours | n/a | 2,176 | 55.70 | 508,890 JPY | -483,600 |
| USD/JPY | 1 hour | n/a | 1,548 | 54.07 | 449,840 JPY | -431,210 |
| USD/JPY | 10 min | n/a | 256 | 53.91 | 347,360 JPY | -282,470 |
| EUR/USD | 10 min | n/a | 96 | 52.08 | 308,238 USD | -82,119 |
| USD/JPY | 15 min | n/a | 330 | 52.73 | 275,920 JPY | -267,040 |
| EUR/USD | 5 min | n/a | 96 | 48.96 | 220,522 USD | -153,172 |
| EUR/USD | Daily | n/a | 2,332 | 58.58 | 130,587 USD | -56,759 |
| Dow Jones | Daily | n/a | 2,069 | 60.27 | 44,774 EUR | -16,838 |
| Silver | 15 min | n/a | 1,380 | 55.72 | 37,932 USD | -29,790 |
| Nasdaq 100 | Daily | n/a | 1,137 | 58.66 | 25,832 EUR | -6,474 |
| US Crude Oil | Daily | n/a | 1,994 | 58.58 | 23,394 EUR | -12,345 |
| DAX 40 | Daily | n/a | 1,808 | 56.53 | 21,517 EUR | -6,042 |
| Silver | Daily | n/a | 623 | 55.22 | 21,449 USD | -16,797 |
| GBP/USD | Daily | n/a | 2,841 | 58.08 | 13,163 USD | -10,446 |
| FTSE 100 | Daily | n/a | 1,484 | 57.35 | 10,604 EUR | -4,572 |
| FTSE 100 | 1 hour | n/a | 1,312 | 55.03 | 9,034 EUR | -3,297 |
| S&P 500 | Daily | n/a | 299 | 57.53 | 6,078 EUR | -1,700 |
| S&P 500 | 15 min | n/a | 90 | 63.33 | 4,871 EUR | -1,267 |
| Gold | 1 hour | n/a | 102 | 56.86 | 3,958 EUR | -1,769 |
| FTSE 100 | 10 min | n/a | 78 | 57.69 | 3,708 EUR | -1,320 |
| Gold | 4 hours | n/a | 115 | 58.26 | 3,586 EUR | -1,649 |
| Gold | 30 min | n/a | 64 | 54.69 | 3,426 EUR | -1,549 |
| Gold | 15 min | n/a | 76 | 52.63 | 3,319 EUR | -1,511 |
| FTSE 100 | 15 min | n/a | 282 | 52.48 | 3,034 EUR | -2,986 |
| S&P 500 | 10 min | n/a | 48 | 52.08 | 2,560 EUR | -1,692 |
| Gold | 10 min | n/a | 46 | 41.30 | 2,158 EUR | -2,068 |
| Gold | 5 min | n/a | 38 | 47.37 | 2,143 EUR | -2,008 |
| Gold | 3 min | n/a | 28 | 46.43 | 2,116 EUR | -1,489 |
| FTSE 100 | 5 min | n/a | 28 | 53.57 | 2,022 EUR | -1,301 |
| S&P 500 | 5 min | n/a | 26 | 69.23 | 2,010 EUR | -1,332 |
| FTSE 100 | 3 min | n/a | 30 | 63.33 | 1,410 EUR | -1,348 |
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.
// ============================================================ // Candle Body Sum Intraday // ProRealAlgos Strategy Library | prorealalgos.com // Type: Mean reversion // Direction: Long & short // Timeframe tested: 30 minutes // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false // --- Parameters --- positionSize = 1 // contracts per trade sumPeriod = 978 // bars summed upperFilter = 51 // sum must exceed this many pips to count as positive lowerFilter = 0 // sum must be below minus this many pips to count as negative invertSignal = 1 // 1 = as tested, -1 flips every signal // --- Indicators --- candleBody = close - open bodyChange = candleBody - candleBody[1] bodySum = Summation[sumPeriod](bodyChange) // Last sum reading on each side of the filters, held until the next one IF bodySum > upperFilter * PipSize THEN positiveSum = bodySum ENDIF IF bodySum < (0 - lowerFilter) * PipSize THEN negativeSum = bodySum ENDIF negativeFalling = negativeSum < negativeSum[1] positiveRising = positiveSum > positiveSum[1]
20 more lines: the entry and exit rules.
Read this first
Questions
Yes, it always holds 1 contract long or short and switches on each reverse signal. The rewritten code has not been compile checked.
Indices, gold, silver, oil and currency pairs from 3 minutes to daily, and every run was profitable. S&P 500 1 hour had a profit factor of 1.88 and Gold Daily 1.77.
On S&P 500 30 minutes the maximum drawdown was EUR 1,368.31 against EUR 6,859.16 net profit.
The long window turns the body sum into a slow gauge of stretched momentum. On 30 minute bars it covers several weeks.
Related
Copy trading on US indices is available to ProRealAlgos members as spots open.