A stretched market is flagged when price closes outside a Bollinger Band, RSI(9) is extreme and the TDI price line is outside its band. The trade opens later, when the TDI price line crosses its signal line back in the reversal direction. An ATR-based stop line then manages the exit.
Best run of 1. FTSE 100, Daily, spread 2, from run sweeps:2026-09-26-FTSE100-D-opt.tsv:4.
| Period | Up to 2026-09-26 |
| Instrument | FTSE 100, Daily |
| Spread | 2 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-26 |
| positionSize Contracts per trade | 1 |
| bandPeriod Bollinger Bands length | 20 |
| rsiPeriod RSI length for the extreme reading | 9 |
| overboughtLevel RSI level that arms a short | 62 |
| oversoldLevel RSI level that arms a long | 28 |
| stopAtrPeriod ATR and average length for the stop line bands | 14 |
| stopAvgPeriod Average of highs / lows that flips the stop line side | 10 |
| tdiRsiPeriod RSI length inside the TDI | 13 |
| tdiBandPeriod TDI band length | 34 |
| tdiBandWidth TDI band width in standard deviations | 1.6185 |
| priceLinePeriod TDI price line smoothing | 2 |
| signalLinePeriod TDI trade signal line smoothing | 7 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| FTSE 100Best run | Daily | n/a | 239 | 38.49 | 3,658 EUR | -2,267 |
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.
// ============================================================ // Bollinger RSI TDI Reversal // ProRealAlgos Strategy Library | prorealalgos.com // Type: Mean reversion // Direction: Long & short // Timeframe tested: Daily // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false // --- Parameters --- positionSize = 1 // contracts per trade bandPeriod = 20 // Bollinger Bands length rsiPeriod = 9 // RSI length for the extreme reading overboughtLevel = 62 // RSI level that arms a short oversoldLevel = 28 // RSI level that arms a long stopAtrPeriod = 14 // ATR and average length for the stop line bands stopAvgPeriod = 10 // average of highs / lows that flips the stop line side tdiRsiPeriod = 13 // RSI length inside the TDI tdiBandPeriod = 34 // TDI band length tdiBandWidth = 1.6185 // TDI band width in standard deviations priceLinePeriod = 2 // TDI price line smoothing signalLinePeriod = 7 // TDI trade signal line smoothing // --- Indicators --- upperBand = BollingerUp[bandPeriod](close) lowerBand = BollingerDown[bandPeriod](close) rsiValue = RSI[rsiPeriod](close) // Stop line: an ATR band that only moves in the trade's favour atrValue = AverageTrueRange[stopAtrPeriod](close) stopBandHigh = Average[stopAtrPeriod](high + atrValue) stopBandLow = Average[stopAtrPeriod](low - atrValue) avgHigh = Average[stopAvgPeriod](high) avgLow = Average[stopAvgPeriod](low) IF close > avgHigh THEN stopSide = 1 ELSIF close < avgLow THEN stopSide = -1 ENDIF IF stopSide = -1 AND stopBandHigh > stopBandHigh[1] THEN stopBandHigh = stopBandHigh[1] ELSIF stopSide = 1 AND stopBandLow < stopBandLow[1] THEN stopBandLow = stopBandLow[1] ENDIF IF stopSide = 1 THEN stopLine = stopBandLow ELSE stopLine = stopBandHigh ENDIF // Traders Dynamic Index tdiRsi = RSI[tdiRsiPeriod](close) tdiMid = Average[tdiBandPeriod](tdiRsi) tdiOffset = tdiBandWidth * STD[tdiBandPeriod](tdiRsi) tdiUpper = tdiMid + tdiOffset tdiLower = tdiMid - tdiOffset priceLine = Average[priceLinePeriod](tdiRsi) signalLine = Average[signalLinePeriod](tdiRsi) // Two-step setup flags, kept between bars ONCE longSetup = 0 ONCE longTrigger = 0 ONCE shortSetup = 0 ONCE shortTrigger = 0
44 more lines: the entry and exit rules.
Read this first
Questions
Yes. It is coded for ProRealTime automated trading with 1 contract per trade. The original session filter hours were not part of the tested code.
On FTSE 100 daily it made EUR 3,658.00 over 239 trades, with a max drawdown of EUR 2,266.60. No other instruments were tested.
The worst peak to trough drop in testing was EUR 2,266.60 at 1 contract. Margin depends on your broker and is not covered here.
The setup needs a close outside the band plus two extreme oscillator readings, which is rare. Daily bars keep those extremes meaningful and the trade count manageable, at 239 trades in the test.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.