Volatility reference

All 8 volatility in AlgoBarsX, each with its parameters, defaults, ranges and an example: atr, true_range, bollinger, keltner, donchian, envelope, hist_volatility, choppiness.

atr true_range bollinger keltner donchian envelope hist_volatility choppiness

atr(length = 14, on = bars())→ series<distance>#

Average true range.

Parameters

NameTypeDefaultRangeWhat it is
lengthint141 to 5000Number of bars in the calculation.
onBarSetbars()Bars to calculate on; defaults to the script's own bars.

Formula Wilder's smoothing (rma) of the true range.

Warm-up length bars

Example
stop_distance = atr(14) * 1.5
strategyindicatoralertlibrarysince 1.0

true_range(on = bars())→ series<distance>#

True range of the current bar.

Parameters

NameTypeDefaultWhat it is
onBarSetbars()Bars to calculate on; defaults to the script's own bars.
Example
tr = true_range()
strategyindicatoralertlibrarysince 1.0

bollinger(source = close, length = 20, multiplier = 2.0)→ Bands#

Bollinger Bands.

Parameters

NameTypeDefaultRangeWhat it is
sourceseries<number>closeSeries to calculate from.
lengthint201 to 5000Number of bars in the calculation.
multipliernumber2.00.1 to 10Standard deviations.

Outputs, read with a dot

NameTypeWhat it is
upperseries<price>Upper band.
middleseries<price>Middle band.
lowerseries<price>Lower band.
widthseries<number>Band width relative to the middle.
percent_bseries<number>Position inside the bands.
Example
bb = bollinger(close, 20, 2.0)
Example
squeeze = bollinger(close).width < 0.02
strategyindicatoralertlibrarysince 1.0

keltner(source = close, length = 20, multiplier = 2.0, atr_length = 10)→ Bands#

Keltner channels.

Parameters

NameTypeDefaultRangeWhat it is
sourceseries<number>closeSeries to calculate from.
lengthint201 to 5000Number of bars in the calculation.
multipliernumber2.00.1 to 10ATR multiplier.
atr_lengthint101 to 5000ATR length.

Outputs, read with a dot

NameTypeWhat it is
upperseries<price>Upper channel.
middleseries<price>Middle line.
lowerseries<price>Lower channel.
Example
kc = keltner(close, 20, 2.0, 10)
strategyindicatoralertlibrarysince 1.0

donchian(length = 20, on = bars())→ Bands#

Donchian channels.

Parameters

NameTypeDefaultRangeWhat it is
lengthint201 to 5000Number of bars in the calculation.
onBarSetbars()Bars to calculate on; defaults to the script's own bars.

Outputs, read with a dot

NameTypeWhat it is
upperseries<price>Highest high.
middleseries<price>Midpoint.
lowerseries<price>Lowest low.
Example
dc = donchian(20)
strategyindicatoralertlibrarysince 1.0

envelope(source = close, length = 20, percent = 2%)→ Bands#

Moving average envelope.

Parameters

NameTypeDefaultRangeWhat it is
sourceseries<number>closeSeries to calculate from.
lengthint201 to 5000Number of bars in the calculation.
percentpercent2%Distance from the average.

Outputs, read with a dot

NameTypeWhat it is
upperseries<price>Upper line.
middleseries<price>Average.
lowerseries<price>Lower line.
Example
env = envelope(close, 20, percent: 2%)
strategyindicatoralertlibrarysince 1.0

hist_volatility(source = close, length = 20, annualize = 252)→ series<number>#

Historical volatility.

Parameters

NameTypeDefaultRangeWhat it is
sourceseries<number>closeSeries to calculate from.
lengthint201 to 5000Number of bars in the calculation.
annualizeint2521 to 100000Periods per year.
Example
hv = hist_volatility(close, 20)
strategyindicatoralertlibrarysince 1.0

choppiness(length = 14, on = bars())→ series<number>#

Choppiness index.

Parameters

NameTypeDefaultRangeWhat it is
lengthint141 to 5000Number of bars in the calculation.
onBarSetbars()Bars to calculate on; defaults to the script's own bars.
Example
chop = choppiness(14)
strategyindicatoralertlibrarysince 1.0

Try this in the Terminal. AlgoBars is free: $0 a month, no card needed.

Create my free account