Indicators/probuilder · probacktest · proorder · proscreener

ChandeKrollStopUp

ChandeKrollStopUp in ProBuilder returns the upper band of the Chande Kroll Stop, an ATR-based trailing stop level for short positions. Syntax and examples.

Syntax

probuilder
ChandeKrollStopUp[Pp, Qq, X]

The instruction takes no price argument. All three parameters go inside the square brackets.

Parameters

NameTypeDefaultDescription
Ppinteger10Lookback period for both the highest high and the ATR used in the first stop calculation.
Qqinteger20Period over which the highest value of the first stop is retained, producing the final band.
Xdecimal3Multiplier applied to the ATR. Larger values place the band further from price and reduce whipsaws.

Formula

code
FirstHighStop     = HighestHigh(Pp) - X * ATR(Pp)
ChandeKrollStopUp = Highest value of FirstHighStop over Qq bars

The ATR is built from the true range, which is the largest of: current high minus current low, current high minus previous close, or previous close minus current low.

How it works

On each bar, ProBuilder first computes a preliminary stop by taking the highest high of the last Pp bars and subtracting X times the ATR measured over the same period. Because the ATR expands with volatility, the preliminary stop automatically moves further from price when the market becomes more volatile.

The final band is the maximum of that preliminary stop over the last Qq bars. Taking the running maximum ratchets the level so that a single quiet bar does not pull the stop closer to price and force a premature exit.

The result is the upper band of the two-band Chande Kroll Stop system. In the usual convention, price trading below this band indicates a downtrend, and a short position is held until price closes back above the band. The companion ChandeKrollStopDown instruction produces the lower band used for long positions.

Examples

Example 1, Plotting both stop bands (Indicator)

probuilder
// Standard Chande Kroll Stop with 10/20 periods and a 3x ATR multiplier
upperBand = ChandeKrollStopUp[10, 20, 3]
lowerBand = ChandeKrollStopDown[10, 20, 3]
RETURN upperBand COLOURED(200, 50, 50) AS "Stop short", lowerBand COLOURED(50, 150, 50) AS "Stop long"

Overlays both bands on the price chart. Price between the bands is considered neutral, above the upper band bullish, below the lower band bearish.

Example 2, Breakout entry when price clears the band (ProBacktest)

probuilder
// Enter long when the bar opens below the upper band and closes above it
i1 = ChandeKrollStopUp[10, 20, 3]
IF (Open < i1 AND Close > i1) THEN
  BUY 1 SHARE AT MARKET
ENDIF

A single bar that opens below and closes above the band signals that sellers lost control of the volatility envelope, which this system treats as a long entry trigger.

Example 3, Scanning for upside band breaks (ProScreener)

probuilder
// List instruments whose close crossed above the Chande Kroll upper band
band = ChandeKrollStopUp[10, 20, 3]
SCREENER[close CROSSES OVER band](close AS "Last price")

Returns every instrument in the watchlist where the close crossed the upper band on the current bar, a candidate list for trend reversals to the upside.

Interpretation

The upper band is a stop level, not a directional oscillator:

  • Price below the band. The short-side stop has not been hit. Short positions managed with this system stay open.
  • Price crosses above the band. The trailing stop for shorts is triggered. Some systems also treat the cross as a long entry, as in Example 2.
  • Band distance. The gap between price and the band widens with volatility because of the ATR term, so position risk stays proportional to current market conditions.

Common errors and gotchas

  • Adding a price argument. ChandeKrollStopUp[10, 20, 3](close) fails to compile. The instruction works directly on the instrument's high, low, and close series and takes only the three bracket parameters.
  • Confusing the two bands. The Up band is built from highs and serves as the stop for short positions. The stop for long positions is ChandeKrollStopDown, built from lows. Swapping them inverts the logic silently.
  • Parameter order. The order is Pp, Qq, X, so ChandeKrollStopUp[3, 10, 20] compiles but treats 20 as the ATR multiplier and produces a band far away from price. Verify the order after editing parameters.
  • Ranging markets. In flat conditions price repeatedly crosses the band in both directions. Combining the band with a trend strength filter such as ADX reduces the number of false triggers.
  • ChandeKrollStopDown, lower band of the same system, used as the stop for long positions.
  • AverageTrueRange, the volatility measure the band is built on.
  • TR, single-bar true range.
  • Highest, highest value of a series over N bars, the ratcheting mechanism of the formula.
  • Lowest, lowest value of a series over N bars.
  • SAR, parabolic stop and reverse, an alternative trailing stop indicator.
  • Supertrend, another ATR-based trend-following stop line.
  • ADX, trend strength filter often paired with stop bands.