Autocorrelation
Autocorrelation measures how much a series of bar returns resembles a lagged copy of itself: a positive value at lag 1 means a bar tends to continue the previous bar's direction, a negative value means bars tend to alternate, and a value near zero means the last bar says little about the next one.
Senzoukria · Glossary · Updated September 2026
Definition and formula
Take the last N bar returns r_1 … r_N and their single mean over the whole window. The autocorrelation at lag k is the sum of (r_j − mean)(r_{j−k} − mean) for j from k+1 to N, divided by the sum of (r_j − mean)² over all N terms. This is the standard Box and Jenkins estimator, and it is the one Senzoukria uses.
The estimator is deliberately unbalanced: the numerator has N − k products while the denominator has N squared deviations. That asymmetry is what keeps the result inside [−1, 1]. The so-called unbiased variant, which divides by N − k, can leave that range and is awkward to plot, which is why it is not used here.
- Input: closed-bar returns, not prices. Autocorrelation of raw prices is close to 1 on almost any window and carries no information.
- A window whose returns are all identical has zero variance; the value is undefined and is reported as missing rather than as zero.
- The lag is a number of bars, so the same setting means different clock time on a 1-minute chart and on a 100-tick chart.
How to read it
- Lag-1 value above zero: recent bars have tended to extend the previous bar. This is the statistical footprint of short-term persistence.
- Lag-1 value below zero: recent bars have tended to reverse the previous bar, the pattern associated with bar-to-bar mean reversion.
- Values close to zero: no linear dependence at that lag on that window. It does not mean the market is unpredictable, only that this particular test found nothing.
- Small windows produce noisy estimates. A value that flips sign every few bars is describing the estimator, not a regime change.
Relation to the Hurst exponent
Autocorrelation and the Hurst exponent ask a related question from different angles. Autocorrelation looks at one lag; the rescaled-range Hurst estimate summarises persistence across the whole window through the range of cumulative deviations. The guide on the Hurst exponent and mean reversion explains why a Hurst value below 0.5 and a negative lag-1 autocorrelation often, but not always, appear together.
In Senzoukria
The catalogue indicator is called Autocorrelation and belongs to the Momentum group. It draws in its own pane under the footprint chart with a window length and a lag as parameters, and the output is hard-bounded to [−1, 1]. It reads the same closed bars as the other pane indicators, so switching bar type changes what a lag means.
The Python strategy template named Mean reversion under regime (HMM + Hurst) in the Scripts editor combines a regime filter, a z-score entry and a Hurst confirmation; autocorrelation is a natural extra check to add in the same script.
Common mistakes
- Computing it on prices instead of returns and concluding that the market is strongly trending.
- Reading a single window's value as a property of the instrument. It is a property of that window.
- Ignoring the warm-up: until N returns exist the value is missing, and a chart that fills the gap with zero is misleading.
- Treating a statistically visible dependence as a tradable one before costs, sample size and execution are considered.
Related
This page in other languages
Frequently asked questions
- Why is the autocorrelation estimator bounded between −1 and 1?
- Because the denominator uses all N squared deviations while the numerator only has N − k cross products. That imbalance is a known property of the Box and Jenkins estimator and it guarantees that the ratio never exceeds 1 in absolute value. The alternative estimator that rescales by N − k can exceed those bounds on short windows.
- Does positive autocorrelation mean the trend will continue?
- No. It means that on the measured window, consecutive returns have tended to share a sign. It is a description of the recent past, and the value on the next window may differ. Any use in a rule needs a written hypothesis, costs and an out-of-sample check.
- What lag should I use?
- Lag 1 is the usual starting point because it asks the simplest question: does this bar relate to the last one? Larger lags test longer dependence but use fewer product terms, so their estimates are noisier for the same window. Change one setting at a time and keep a record of what you tried.