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
| Name | Type | Default | Range | What it is |
|---|---|---|---|---|
length | int | 14 | 1 to 5000 | Number of bars in the calculation. |
on | BarSet | bars() | Bars to calculate on; defaults to the script's own bars. |
stop_distance = atr(14) * 1.5strategyindicatoralertlibrarysince 1.0
true_range(on = bars())→ series<distance>#
True range of the current bar.
Parameters
| Name | Type | Default | What it is |
|---|---|---|---|
on | BarSet | bars() | Bars to calculate on; defaults to the script's own bars. |
tr = true_range()strategyindicatoralertlibrarysince 1.0
bollinger(source = close, length = 20, multiplier = 2.0)→ Bands#
Bollinger Bands.
Parameters
| Name | Type | Default | Range | What it is |
|---|---|---|---|---|
source | series<number> | close | Series to calculate from. | |
length | int | 20 | 1 to 5000 | Number of bars in the calculation. |
multiplier | number | 2.0 | 0.1 to 10 | Standard deviations. |
Outputs, read with a dot
| Name | Type | What it is |
|---|---|---|
upper | series<price> | Upper band. |
middle | series<price> | Middle band. |
lower | series<price> | Lower band. |
width | series<number> | Band width relative to the middle. |
percent_b | series<number> | Position inside the bands. |
bb = bollinger(close, 20, 2.0)squeeze = bollinger(close).width < 0.02strategyindicatoralertlibrarysince 1.0
keltner(source = close, length = 20, multiplier = 2.0, atr_length = 10)→ Bands#
Keltner channels.
Parameters
| Name | Type | Default | Range | What it is |
|---|---|---|---|---|
source | series<number> | close | Series to calculate from. | |
length | int | 20 | 1 to 5000 | Number of bars in the calculation. |
multiplier | number | 2.0 | 0.1 to 10 | ATR multiplier. |
atr_length | int | 10 | 1 to 5000 | ATR length. |
Outputs, read with a dot
| Name | Type | What it is |
|---|---|---|
upper | series<price> | Upper channel. |
middle | series<price> | Middle line. |
lower | series<price> | Lower channel. |
kc = keltner(close, 20, 2.0, 10)strategyindicatoralertlibrarysince 1.0
donchian(length = 20, on = bars())→ Bands#
Donchian channels.
Parameters
| Name | Type | Default | Range | What it is |
|---|---|---|---|---|
length | int | 20 | 1 to 5000 | Number of bars in the calculation. |
on | BarSet | bars() | Bars to calculate on; defaults to the script's own bars. |
Outputs, read with a dot
| Name | Type | What it is |
|---|---|---|
upper | series<price> | Highest high. |
middle | series<price> | Midpoint. |
lower | series<price> | Lowest low. |
dc = donchian(20)strategyindicatoralertlibrarysince 1.0
envelope(source = close, length = 20, percent = 2%)→ Bands#
Moving average envelope.
Parameters
| Name | Type | Default | Range | What it is |
|---|---|---|---|---|
source | series<number> | close | Series to calculate from. | |
length | int | 20 | 1 to 5000 | Number of bars in the calculation. |
percent | percent | 2% | Distance from the average. |
Outputs, read with a dot
| Name | Type | What it is |
|---|---|---|
upper | series<price> | Upper line. |
middle | series<price> | Average. |
lower | series<price> | Lower line. |
env = envelope(close, 20, percent: 2%)strategyindicatoralertlibrarysince 1.0
hist_volatility(source = close, length = 20, annualize = 252)→ series<number>#
Historical volatility.
Parameters
| Name | Type | Default | Range | What it is |
|---|---|---|---|---|
source | series<number> | close | Series to calculate from. | |
length | int | 20 | 1 to 5000 | Number of bars in the calculation. |
annualize | int | 252 | 1 to 100000 | Periods per year. |
hv = hist_volatility(close, 20)strategyindicatoralertlibrarysince 1.0
choppiness(length = 14, on = bars())→ series<number>#
Choppiness index.
Parameters
| Name | Type | Default | Range | What it is |
|---|---|---|---|---|
length | int | 14 | 1 to 5000 | Number of bars in the calculation. |
on | BarSet | bars() | Bars to calculate on; defaults to the script's own bars. |
chop = choppiness(14)strategyindicatoralertlibrarysince 1.0