Statistics reference

All 16 statistics in AlgoBarsX, each with its parameters, defaults, ranges and an example: stdev, mean, median, variance, percentile, percent_rank, zscore, returns, correlation, covariance and 6 more.

stdev mean median variance percentile percent_rank zscore returns correlation covariance beta skew kurtosis rank autocorrelation hurst

stdev(source = close, length = 20)→ distance of source#

Standard deviation.

Parameters

NameTypeDefaultRangeWhat it is
sourceseries<number>closeSeries to calculate from.
lengthint201 to 5000Number of bars in the calculation.
Example
dispersion = stdev(close, 20)
strategyindicatoralertlibrarysince 1.0

mean(source = close, length = 20)→ like source#

Mean value.

Parameters

NameTypeDefaultRangeWhat it is
sourceseries<number>closeSeries to calculate from.
lengthint201 to 5000Number of bars in the calculation.
Example
avg = mean(close, 20)
strategyindicatoralertlibrarysince 1.0

median(source = close, length = 20)→ like source#

Median value.

Parameters

NameTypeDefaultRangeWhat it is
sourceseries<number>closeSeries to calculate from.
lengthint201 to 5000Number of bars in the calculation.
Example
mid = median(close, 20)
strategyindicatoralertlibrarysince 1.0

variance(source = close, length = 20)→ series<number>#

Variance.

Parameters

NameTypeDefaultRangeWhat it is
sourceseries<number>closeSeries to calculate from.
lengthint201 to 5000Number of bars in the calculation.
Example
var_now = variance(close, 20)
strategyindicatoralertlibrarysince 1.0

percentile(source = close, length = 100, percent = 50%)→ like source#

Value at a percentile of recent values.

Parameters

NameTypeDefaultRangeWhat it is
sourceseries<number>closeSeries to calculate from.
lengthint1001 to 5000Number of bars in the calculation.
percentpercent50%Percentile to return.
Example
p90 = percentile(close, 100, percent: 90%)
strategyindicatoralertlibrarysince 1.0

percent_rank(source = close, length = 100)→ series<number>#

How many of the recent values are below this one, as a percentage from 0 to 100.

Parameters

NameTypeDefaultRangeWhat it is
sourceseries<number>closeSeries to calculate from.
lengthint1001 to 5000Number of bars in the calculation.
Example
standing = percent_rank(close, 100)
strategyindicatoralertlibrarysince 1.0

zscore(source = close, length = 20)→ series<number>#

Standard score of the current value.

Parameters

NameTypeDefaultRangeWhat it is
sourceseries<number>closeSeries to calculate from.
lengthint201 to 5000Number of bars in the calculation.
Example
z = zscore(close, 20)
strategyindicatoralertlibrarysince 1.0

returns(source = close, periods = 1)→ series<number>#

Fractional change between bars.

Parameters

NameTypeDefaultRangeWhat it is
sourceseries<number>closeSeries to calculate from.
periodsint11 to 5000Bars between the two values.
Example
r1 = returns(close)
strategyindicatoralertlibrarysince 1.0

correlation(a, b, length = 50)→ series<number>#

Pearson correlation.

Parameters

NameTypeDefaultRangeWhat it is
aseries<number>requiredFirst series.
bseries<number>requiredSecond series.
lengthint501 to 5000Number of bars in the calculation.
Example
corr = correlation(close_of(EURUSD), close_of(GBPUSD), 50)
strategyindicatoralertlibrarysince 1.0

covariance(a, b, length = 50)→ series<number>#

Covariance.

Parameters

NameTypeDefaultRangeWhat it is
aseries<number>requiredFirst series.
bseries<number>requiredSecond series.
lengthint501 to 5000Number of bars in the calculation.
Example
cov_now = covariance(returns(close_of(EURUSD)), returns(close_of(GBPUSD)), 50)
strategyindicatoralertlibrarysince 1.0

beta(asset, benchmark, length = 100)→ series<number>#

Beta of an asset against a benchmark.

Parameters

NameTypeDefaultRangeWhat it is
assetseries<number>requiredAsset returns.
benchmarkseries<number>requiredBenchmark returns.
lengthint1001 to 5000Number of bars in the calculation.
Example
b = beta(returns(close_of(EURUSD)), returns(close_of(GBPUSD)), 100)
strategyindicatoralertlibrarysince 1.0

skew(source = close, length = 50)→ series<number>#

Skewness.

Parameters

NameTypeDefaultRangeWhat it is
sourceseries<number>closeSeries to calculate from.
lengthint501 to 5000Number of bars in the calculation.
Example
asymmetry = skew(returns(close), 50)
strategyindicatoralertlibrarysince 1.0

kurtosis(source = close, length = 50)→ series<number>#

Excess kurtosis.

Parameters

NameTypeDefaultRangeWhat it is
sourceseries<number>closeSeries to calculate from.
lengthint501 to 5000Number of bars in the calculation.
Example
tails = kurtosis(returns(close), 50)
strategyindicatoralertlibrarysince 1.0

rank(source = close, length = 50)→ series<number>#

Rank of the current value among recent values.

Parameters

NameTypeDefaultRangeWhat it is
sourceseries<number>closeSeries to calculate from.
lengthint501 to 5000Number of bars in the calculation.
Example
position_rank = rank(close, 50)
strategyindicatoralertlibrarysince 1.0

autocorrelation(source = close, length = 50, lag = 1)→ series<number>#

Autocorrelation at a lag.

Parameters

NameTypeDefaultRangeWhat it is
sourceseries<number>closeSeries to calculate from.
lengthint501 to 5000Number of bars in the calculation.
lagint11 to 500Bars of lag.
Example
ac = autocorrelation(returns(close), 50, lag: 1)
strategyindicatoralertlibrarysince 1.0

hurst(source = close, length = 100)→ series<number>#

Hurst exponent, on returns rather than prices. Prices trend by construction, so hurst(close, n) reads high for a random walk, a trend and a mean-reverting market alike and cannot tell them apart; hurst(returns(close), n) can.

Parameters

NameTypeDefaultRangeWhat it is
sourceseries<number>closeSeries to calculate from.
lengthint1001 to 5000Number of bars in the calculation.
Example
persistence = hurst(returns(close), 100)
strategyindicatoralertlibrarysince 1.0

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

Create my free account