Breakouts after quiet trading can look identical to breakouts in already volatile markets. Can a ProRealTime strategy distinguish them without letting the breakout candle itself contaminate the volatility filter?
What you will learn
- Define compression using only pre-breakout ATR data.
- Combine a range breakout with fixed protective exits.
- Implement historical indexing and market orders in ProOrder.
- Test whether compression adds value after costs.
Separate the setup from the trigger
Calculate 14-period ATR and its 30-bar simple average. On the completed signal bar, compare the previous bar's ATR with 75% of the average as of two bars ago. This excludes both the breakout bar and the measured ATR observation from the baseline's most recent observation. The ATR series itself is overlapping and not statistically independent. Require the current close to exceed the highest high of the preceding 20 bars. Enter long only when flat in this long-only model.
Numerical example
With a baseline of 2.00 price units, the compression limit is 1.50. Prior ATR readings of 1.20 and 1.50 qualify, whereas 1.80 fails. A qualifying reading alone does not trigger an order: if the preceding range high is 105, the completed close must exceed 105.

Hypothetical ATR observations compared with the same compression threshold.
ProOrder implementation
DEFPARAM CumulateOrders = False
atrNow = AverageTrueRange[14](Close)
atrBase = Average[30](atrNow)
ceiling = Highest[20](High[1])
IF NOT LongOnMarket AND BarIndex > 50 THEN
IF atrBase[2] > 0 AND atrNow[1] <= 0.75 * atrBase[2] AND Close > ceiling THEN
BUY 1 CONTRACT AT MARKET
ENDIF
ENDIF
SET STOP pLOSS 20
SET TARGET pPROFIT 40
IF LongOnMarket AND Close < Average[20](Close) THEN
SELL AT MARKET
ENDIF
The example uses one contract, a 20-point stop and 40-point target, and a close below the 20-bar moving average as an additional exit. Point distances are not cash amounts: check the instrument's point value and minimum order size. Market instructions generated on completed bars are subject to subsequent execution; a backtest's next-bar fill is not a guaranteed live price. Disable accumulation and configure sufficient preloaded history. Review the ProBacktest and ProOrder programming manuals at ProRealTime for instrument-specific order restrictions. In live use, reconcile broker positions, rejected orders and competing exits. Stops can slip or gap.
Testing the hypothesis
Compare the same breakout strategy with and without the compression condition. Test thresholds of 0.60, 0.75 and 0.90 while holding exits, quantity and costs constant. Track rejected signals, trade count, adverse excursion, drawdown and net results across separate market regimes. Include zero baseline, exact threshold equality, overnight gaps and bars touching both protective levels. Use out-of-sample data and realistic spread and commission assumptions. Compression may persist without a breakout or precede a false breakout; no profitability is implied. This illustrative code has not been compiled or backtested. Trading involves substantial risk.
For tailored execution and risk controls, see Custom ProRealTime strategy Development Services.