It waits for an inside bar whose range is the narrowest of the last 2 bars, while Bollinger Band width is at a 17-bar low. ADX(10) must be above 17 and ATR(1) above ATR(9). Stop orders go 1.5 above and below the bar, with ATR based stop, target and trailing stop.
Best run of 10. US Crude Oil, 1 hour, spread 3, from run sweeps:2026-09-17-CRUDE-1h-opt.tsv:2.
| Period | Up to 2026-09-17 |
| Instrument | US Crude Oil, 1 hour |
| Spread | 3 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-17 |
| positionSize Contracts per trade | 1 |
| narrowLookback Bar range must be below the lowest range of this many prior bars | 2 |
| bandPeriod Bollinger Band width length | 20 |
| squeezeLookback Band width must be below its lowest of this many prior bars | 17 |
| adxPeriod ADX length | 10 |
| adxThreshold Minimum ADX | 17 |
| fastAtrPeriod Short ATR that must exceed the longer one | 1 |
| slowAtrPeriod Longer ATR for that comparison | 9 |
| entryOffset Stop entry distance beyond the bar high / low | 1.5 |
| atrPeriod ATR length for stops, targets and trailing | 14 |
| longTrailAtr Long trailing distance in ATRs | 2.5 |
| shortTrailAtr Short trailing distance in ATRs | 1.7 |
| stopAtrMultiple Protective stop in ATRs | 2.7 |
| targetAtrMultiple Profit target in ATRs | 7.2 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| US Crude OilBest run | 1 hour | n/a | 118 | 52.54 | 2,602 EUR | -1,047 |
| Silver | 4 hours | n/a | 9 | 22.22 | 4,120 USD | -3,011 |
| Nikkei 225 | 15 min | n/a | 79 | 53.16 | 2,091 USD | -1,596 |
| Nikkei 225 | Daily | n/a | 3 | 66.67 | 1,888 USD | -1,776 |
| Brent Crude | 10 min | n/a | 85 | 48.24 | 1,329 EUR | -383 |
| Silver | Daily | n/a | 6 | 66.67 | 669 USD | -596 |
| FTSE 100 | 15 min | n/a | 106 | 50.94 | 440 EUR | -285 |
| Brent Crude | 5 min | n/a | 58 | 55.17 | 320 EUR | -273 |
| Gold | 30 min | n/a | 27 | 62.96 | 81.40 EUR | -49.60 |
| Gold | 5 min | n/a | 21 | 61.90 | 68.70 EUR | -53.70 |
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.
// ============================================================ // Inside Day NR2 Squeeze // ProRealAlgos Strategy Library | prorealalgos.com // Type: Volatility // Direction: Long & short // Timeframe tested: 1 hour // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false // --- Parameters --- positionSize = 1 // contracts per trade narrowLookback = 2 // bar range must be below the lowest range of this many prior bars bandPeriod = 20 // Bollinger Band width length squeezeLookback = 17 // band width must be below its lowest of this many prior bars adxPeriod = 10 // ADX length adxThreshold = 17 // minimum ADX fastAtrPeriod = 1 // short ATR that must exceed the longer one slowAtrPeriod = 9 // longer ATR for that comparison entryOffset = 1.5 // stop entry distance beyond the bar high / low atrPeriod = 14 // ATR length for stops, targets and trailing longTrailAtr = 2.5 // long trailing distance in ATRs shortTrailAtr = 1.7 // short trailing distance in ATRs stopAtrMultiple = 2.7 // protective stop in ATRs targetAtrMultiple = 7.2 // profit target in ATRs // --- Indicators --- // Inside bar with the smallest range recently, inside a Bollinger squeeze. narrowInsideBar = high < high[1] AND low > low[1] AND Range < Lowest[narrowLookback](Range)[1] bandSqueeze = BollingerBandWidth[bandPeriod](close) < Lowest[squeezeLookback](BollingerBandWidth[bandPeriod](close)[1]) adxValue = ADX[adxPeriod] atrValue = AverageTrueRange[atrPeriod](close) longTrailDistance = atrValue * longTrailAtr shortTrailDistance = atrValue * shortTrailAtr
37 more lines: the entry and exit rules.
Read this first
Questions
Yes. It places two stop entries per setup bar and ATR based exits, all of which ProOrder supports. Compile-check the rewritten code on demo first.
US Crude Oil 1 hour was the best with EUR 2,602.4. Nikkei 225 15 minutes made USD 2,090.6 and Brent Crude 10 minutes EUR 1,329.4.
The best run had a max drawdown of EUR 1,047.0. Silver 4 hours dropped USD 3,010.5 on only 9 trades.
Inside bars and squeezes need enough bars per week to appear. On 1 hour crude oil the setup produced 118 trades, while Daily charts produced only a few.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.