A band-based trend state turns bullish when the close breaks above the upper band. It buys on that flip when the close is above the 4-bar SMA and MACD is above its signal line, and exits when the trend turns bearish.
Best run of 7. USD/JPY, 4 hours, spread 1, from run sweeps:2026-10-12-USDJPY-4h-opt.tsv:25.
| Period | Up to 2026-10-12 |
| Instrument | USD/JPY, 4 hours |
| Spread | 1 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-12 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| USD/JPYBest run | 4 hours | n/a | 2,103 | 36.90 | 531,010 USD | -241,880 |
| Nikkei 225 | Daily | n/a | 615 | 38.86 | 20,581 USD | -20,311 |
| DAX 40 | 4 hours | n/a | 1,790 | 39.83 | 13,211 EUR | -4,512 |
| DAX 40 | Daily | n/a | 580 | 39.48 | 6,892 EUR | -5,307 |
| Nasdaq 100 | Daily | n/a | 685 | 40.29 | 5,529 EUR | -4,419 |
| Gold | 4 hours | n/a | 1,845 | 37.72 | 2,506 EUR | -738 |
| Gold | Daily | n/a | 725 | 35.17 | 1,960 EUR | -1,349 |
Charts
The code
// ============================================================== // Adaptive Trend Flow Long // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long only // Timeframe tested: 4 hours // ============================================================== DEFPARAM CumulateOrders = false ONCE trend = 0 ONCE init = 0 typ = TypicalPrice fast = ExponentialAverage[2](typ) slow = ExponentialAverage[4](typ) basis = (fast + slow) / 2 vol = STD[2](typ) svol = ExponentialAverage[2](vol) upper = basis + svol * 2 lower = basis - svol * 2 sma = Average[4](close) myMacd = ExponentialAverage[2](close) - ExponentialAverage[7](close) signal = ExponentialAverage[2](myMacd) prevtrend = trend
29 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 7 market and timeframe combinations. The best run by trade count was USD/JPY, 4 hours, with 2,103 trades.
The best run had a maximum drawdown of 241,880 USD at the tested position size, against a net result of 531,010 USD.
It only takes long trades.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.