Volatility
Volatility in ProBuilder returns the Chaikin Volatility indicator, comparing the recent high to low spread with an earlier period. Syntax and examples.
Syntax
Volatility[S, L]Parameters
| Name | Type | Default | Description |
|---|---|---|---|
S | integer | none | Number of bars in the recent short-term window. A common setting is 10. |
L | integer | none | Number of bars defining the earlier long-term reference the recent window is compared against. A common setting is 20. |
The function takes no price argument, it is computed from the instrument's high and low series.
Formula
spread = smoothed value of (high - low) over S bars
Volatility = percentage change of spread versus its level L bars backThe indicator smooths the bar-by-bar high-low spread over the short period, then expresses how far that smoothed spread has moved relative to its earlier value defined by the long period. The output is a percentage-style oscillator around zero.
Notes: the source describes the calculation as a comparison of recent volatility against a previous period; the exact smoothing internals are handled by the platform.
How it works
Chaikin Volatility, developed by Marc Chaikin, defines volatility as the width of the trading range, the distance between high and low, rather than the size of close-to-close changes. Direction is deliberately ignored: a wide down bar and a wide up bar contribute equally.
Smoothing the spread over S bars removes single-bar noise, and comparing the result against its own level from the earlier L bar reference turns the measure into a rate of change. A positive reading means bars have become wider on average than they were, a negative reading means ranges are contracting. The value is a relative measure, so it can be compared across instruments in a way raw range measures cannot.
Typical uses are regime detection and trade filtering: requiring rising volatility before breakout entries, avoiding new positions when ranges are collapsing, or scaling stop distances alongside measures such as AverageTrueRange.
Examples
Example 1, Chaikin Volatility panel (Indicator)
// Compare the last 10 bars of range against the 20 bars before
myVolatility = Volatility[10, 20]
RETURN myVolatilityPlots the oscillator in its own panel. Peaks mark range expansion, troughs mark contraction phases.
Example 2, Trade only in expanding volatility (ProBacktest)
// Trend entry gated by rising volatility
vol = Volatility[10, 20]
IF NOT ONMARKET AND vol > 0 AND close CROSSES OVER Average[50](close) THEN
BUY 1 CONTRACT AT MARKET
ENDIF
IF ONMARKET AND close CROSSES UNDER Average[50](close) THEN
SELL AT MARKET
ENDIFThe moving average breakout is only taken while the Chaikin Volatility is positive, i.e. while bar ranges are expanding, filtering out signals that fire in dead markets.
Example 3, Volatility expansion scan (ProScreener)
vol = Volatility[10, 20]
SCREENER[vol > 25] (vol AS "Chaikin Volatility")Returns instruments whose smoothed trading range has grown more than 25 percent relative to the earlier reference period, surfacing markets that are waking up.
Interpretation
| Reading | Meaning |
|---|---|
| Rising / positive | Bar ranges are widening, activity increasing. |
| Falling / negative | Ranges are contracting, market quieting down. |
| Sharp spike | Often accompanies panic moves or news events. |
Chaikin's own observations link volatility spikes after extended declines to potential market bottoms, and slowly declining volatility during an advance to maturing tops. These are contextual tendencies, not signals on their own. The indicator says nothing about direction; it is best combined with a directional tool, using volatility as the filter and the other tool for the signal.
Common errors and gotchas
- Treating it as directional. High readings mean wide bars, not rising prices. A volatility spike is equally compatible with a crash and a rally.
- Parameter order. The short period comes first:
Volatility[10, 20]. Reversing the arguments produces a different and misleading series. - Gap blindness. The calculation is based on the high-low spread of each bar, which excludes overnight gaps. On gap-prone instruments,
AverageTrueRangecaptures total movement more faithfully. - Fixed thresholds transfer poorly. A screener level such as 25 behaves differently across timeframes and markets. Calibrate thresholds against the instrument's own history.
Related instructions
HistoricVolatility, statistical volatility computed from returns.AverageTrueRange, gap-aware volatility in price units.TR, raw true range of a single bar.STD, standard deviation of a series.BollingerBandWidth, band width as an alternative expansion gauge.ChaikinOsc, Chaikin's volume-based oscillator.Range, plain high minus low of the current bar.MassIndex, range-based reversal detection indicator.
