Separate entry volatility from subsequent volatility

An ATR-based breakout strategy often recalculates its protective stop distance on every bar. When volatility rises after entry, this can unintentionally increase the original loss budget. This ProRealTime ProOrder example freezes the ATR-derived distance at the entry signal and retains it throughout the position. It is a long-only research template, not a claim of superior returns.

Rules and numerical example

On a completed bar, require the close to exceed the highest high of the preceding 20 bars. Calculate the 14-period ATR and store twice its value as the initial stop distance. Enter one contract at market, without pyramiding. Exit on the protective stop or a completed close below the preceding ten-bar low, whichever executes first. For an illustrative fill of 105 and signal ATR of 2 price units, the stop distance is 4 price units and the intended stop is 101. If ATR later increases to 3, a continuously recalculated stop would widen to 99; the frozen stop remains 101. The diagram shows hypothetical price movement, not historical performance.

Freezing Signal ATR Stop Distance in ProOrder Breakout Strategies

Comparison of the frozen four-unit stop with a hypothetical six-unit widened stop. Candles beyond the fixed stop illustrate the counterfactual market path, not continued exposure after exit.

ProOrder implementation

DEFPARAM CumulateOrders = False
DEFPARAM PreLoadBars = 200

atrValue = AverageTrueRange[14](Close)
upperLevel = Highest[20](High[1])
lowerLevel = Lowest[10](Low[1])

IF NOT LongOnMarket AND atrValue > 0 THEN
    IF Close > upperLevel THEN
        riskPoints = 2 * atrValue / PointSize
        BUY 1 CONTRACT AT MARKET
        SET STOP pLOSS riskPoints
    ENDIF
ENDIF

IF LongOnMarket THEN
    SET STOP pLOSS riskPoints
    IF Close < lowerLevel THEN
        SELL AT MARKET
    ENDIF
ENDIF

ProOrder's SET STOP pLOSS expresses the distance in platform points; dividing a price-unit ATR by PointSize converts it to that unit. Confirm the instrument's point definition and permitted price increments in your installation. The stop is relative to the entry fill, not the signal close. The riskPoints variable is assigned only when a fresh flat-position entry signal occurs, and is reused while long. A market order normally executes on the following bar in standard bar-based simulation; the actual fill may differ. See the ProBacktest and ProOrder programming manual for order and stop syntax.

Execution safeguards and research design

Use a dedicated strategy instance and validate that the stop is accepted after entry. If the instrument requires a minimum stop distance or quantity, reject incompatible signals rather than silently increasing the intended risk. The sample assumes ordinary bar-close evaluation and a single position; it does not implement recovery of stored riskPoints after a live restart, broker rejection handling, or portfolio-level risk limits. For production, reconcile the actual position and protective order on startup and define an explicit response to missing protection.

Compare three variants with identical entries and channel exits: fixed price distance, frozen signal ATR distance, and continuously recalculated ATR distance. Use realistic commissions and slippage, inspect maximum adverse excursion and realized loss distribution, and test quiet and volatile periods separately. Check gap-through-stop behavior and bars where both exit conditions may occur; use finer data when available. The code has not been compiled or backtested here. Stops are not guaranteed execution prices, and leveraged trading can cause substantial losses.

For custom stop lifecycle and execution controls, see Custom ProRealTime strategy Development Services.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.