$DWC 1-Minute Differenced Series

Mean Reversion Tests on DARWIN $DWC

In a previous post – Quantitative Modeling for Algorithmic Traders – we discussed the importance of Expectation, Variance, Standard Deviation, Covariance and Correlation.

In this post we’ll discuss how those concepts can be applied to DARWIN assets.

As a practical example, we will employ a series of statistical tests to assess if DARWIN $DWC is a Mean Reverting time series or otherwise.


These will include:

1) Hurst Exponent
2) Augmented Dickey-Fuller Test (ADF)
3) Half-life of Mean Reversion


In case you missed it, the mean reverting nature of DARWIN $DWC was discussed in our most recent post here.

Tests will be conducted on 1-Minute returns from $DWC, results and interpretation being published along the way. As always, please share your comments, feedback and suggestions in the comments at the end.

Note: Different statistical tests don’t always lead to similar outcomes, therefore it’s considered good practice to use at least two when evaluating mean reversion or any other statistical properties.

Before proceeding further, it’s important that we understand what Autocorrelation and Stationarity are.

Autocorrelation (Serial Correlation)

Autocorrelation (Serial Correlation)


Also referred to as Serial Correlation.

It is a measure of the similarity or relationship between a time series and a delayed or “lagged” version of the same time series, over successive periods in time.




Stationary Time Series

Stationary Time Series


A time series is considered stationary if its core statistical attributes remain constant over time.

These include mean, variance, standard deviation, autocorrelation, etc.

Stationary series demonstrate high predictability.



If a time series (e.g. DARWIN) can be mathematically transformed to approximately stationary, future Quotes of the time series (or trade entry direction / entries) can be reverse engineered from future points in its forecasted stationary series.

More on this in future blog posts.

Prior Assumptions:

Prior to conducting these tests on $DWC data, we are expecting to see a reasonable degree of mean reversion for the following reasons:

  1. There is visual confirmation (see below) that mean reverting tendency may exist.
  2. As $DWC behaves in relation to real time trader sentiment, it is reasonable to assume that it could exhibit cyclical behaviour.
$DWC 1-Minute Data Plot

$DWC 1-Minute Data Plot

$DWC 1-Minute Differenced Series

$DWC 1-Minute Differenced Series

Mean Reversion Test #1: Hurst Exponent

Mean Reversion in a time series can be assessed in terms of its rate of diffusion from inception.


For a time series X to be considered mean reverting:

Rate of Diffusion (X) < Rate of Diffusion of a Geometric Random Walk (GBM)


This rate of diffusion can be measured as the variance of the logarithm of the time series, at a random time interval T:

\(Var(T) = \left \langle \left | log(t + T) – log(t) \right |^{2} \right \rangle\)


If a time series is a GBM, then Var(T) ~ T, as T gets larger:

\(\left \langle \left | log(t + T) – log(t) \right |^{2} \right \rangle\) ~ T


If a time series is either trending or mean reverting, then:

\(\left \langle \left | log(t + T) – log(t) \right |^{2} \right \rangle\) ~ \(T^{2H}\)

.. where H is the Hurst Exponent, a measure of the extent to which the time series trends or mean reverts.


Hurst Exponent Interpretation:

If H > 0.5, the time series is TRENDING
If H < 0.5, the time series is Mean Reverting
If H = 0.5, the time series is a Geometric Random Walk


The DWC’s Hurst Exponent can be easily calculated in R, using the “pracma” library.

Note: For all code examples in this blog post, we have pre-loaded M1 data as “DWC.M1” to save time.

library(pracma)# Print M1 data Hurst Exponent
> hurstexp(log(DWC.M1$quote))
Simple R/S Hurst estimation: 0.8962816
Corrected R over S Hurst exponent: 0.9945418
Empirical Hurst exponent: 1.001317
Corrected empirical Hurst exponent: 0.9938308
Theoretical Hurst exponent: 0.520278

This first test shows that though this sample of DWC data is not demonstrating mean reverting behaviour (Theoretical Hurst Exponent > 0.5), it is not trending significantly either -> i.e. it is almost behaving like a GBM as per this test’s results (H = 0.520278), reducing the probability of DWC being a non-stationary random walk process.

Mean Reversion Test #2: Augmented Dickey-Fuller Test

If the $DWC time series is not a random walk (non-stationary series), then any Quote in the series will have a proportional relationship with the Quote immediately before it.

If $DWC is mean reverting, then any move higher above its mean would likely be followed by a move lower and vice versa.

The ADF Test checks for the presence of unit roots in a time series that’s autoregressive in nature, and for the tendency of a time series to mean revert.

Consider the following autoregressive model of order p:

\(\Delta x_{t} = \alpha + \beta t + \gamma x_{t-1} + \delta _{1}\Delta x_{t-1} + … + \delta _{p-1}\Delta x_{t-p+1} + \epsilon _{t}\)

The ADF test will statistically evaluate if γ = 0 (the null hypothesis) can be rejected at a given confidence interval.

If the null hypothesis can be rejected, it implies that the time series is not a random walk (non-stationary / no linear relationship between data points), and that there is a linear relationship between the current DWC Quote and the one immediately before it (stationary).


The ADF Test can be carried out in R quite easily, using the “urca” library.

ADF Test (1-minute DWC data):

> library(urca)
> summary(ur.df(DWC.M1$quote, type="drift", lags=1))
# Augmented Dickey-Fuller Test Unit Root Test #
Test regression driftCall:
lm(formula = z.diff ~ z.lag.1 + 1 + z.diff.lag)
Min 1Q Median 3Q Max
-1.66860 -0.01990 0.00008 0.02011 1.16945
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.0347880 0.0114228 3.045 0.00232 **
z.lag.1 -0.0003287 0.0001075 -3.057 0.00224 **
z.diff.lag -0.0365180 0.0045255 -8.069 7.22e-16 ***
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.04493 on 48479 degrees of freedom
Multiple R-squared: 0.001542, Adjusted R-squared: 0.001501
F-statistic: 37.45 on 2 and 48479 DF, p-value: < 2.2e-16
Value of test-statistic is: -3.0566 4.849Critical values for test statistics:
1pct 5pct 10pct
tau2 -3.43 -2.86 -2.57
phi1 6.43 4.59 3.78


Interpretation of ADF Test Results

Referring back to the autoregressive model earlier:

\(\Delta x_{t} = \alpha + \beta t + \gamma x_{t-1} + \delta _{1}\Delta x_{t-1} + … + \delta _{p-1}\Delta x_{t-p+1} + \epsilon _{t}\)

z.lag.1 = The value of the test-statistic γ (gamma) in the above equation.

tau2 = Critical values corresponding to the null hypothesis (γ = 0)

In order to reject the null hypothesis (γ = 0 – i.e. to reject that DWC is a non-stationary random walk), the value of the test statistic must be smaller than the critical values in tau2 (1%, 5% and 10% confidence intervals).

As z.lag.1 is -3.0566 (smaller than the critical values for the 5% and 10% confidence intervals), the null hypothesis can be rejected at the 90% and 95% confidence intervals, i.e. the probability of DWC being stationary (or not a random walk) is very high.

The tests above were also conducted on 30-minute, 1-hour, 2-hour, 4-hour and Daily precision $DWC data.

  1. Daily precision lead to the null hypothesis for the presence of a unit root being rejected at the 90% confidence interval. This test will be repeated periodically as more data is accrued over time.
  2. 30-minute, 1-hour, 2-hour and 4-hour tests all lead to the null hypothesis for the presence of a unit root being rejected at the 95% confidence interval.

Mean Reversion Test #3: Half-life of Mean Reversion

An alternative to the autoregressive linear model described above, is to consider how long any particular time series takes “to mean revert”.

By definition, a change in the next periodic value of a mean-reverting time series is proportional to the difference between the historical mean of the series and the current value.

Such time series are referred to as Ornstein-Uhlenbeck processes.

The differential of the earlier model leads us to the expected value of x(t):

\(E(x_{t}) = x_{0}e^{\gamma t} – \frac{\mu }{1 – e^{\gamma t}}\)

If DWC is a mean reverting series, and has a negative \(\gamma\), then the equation above tells us that DWC prices decay exponentially, with a half-life of \(\frac {-log(2)}{\gamma}\).

This means we now have two tasks ahead of us:

  1. Find \(\gamma\) and check if it is negative.
  2. Calculate the half-life and assess whether it is a practical length of time for traders to consider a mean reverting strategy on DWC.

Once again, we can easily conduct both steps in R.

Step 1: Calculate \(\gamma\) and check sign.

> <- as.ts(DWC.M1$quote)
> <- lag(, -1)
> <- diff(
> <- cbind(,,
> <-[-1,]

> M1.regression <- lm( ~,

> gamma <- summary(M1.regression)$coefficients[2]
> print(gamma)
[1] -0.0003588994

\(\gamma\) is negative (-0.0003588994), so this $DWC 1-minute data sample can be considered mean reverting.


Step 2: Calculate half-life and assess practicality of mean reversion strategy.

> <- -log(2) / gamma> print(paste("Half-life: ",, " minutes, or ",, " Hours", sep=""))
[1] "Half-life: 1931.31306610404 minutes, or 32.1885511017341 Hours"

The half-life calculated for this $DWC 1-minute data sample is 32 hours.


Another important feature of the calculated half-life, is that it can be used as the period of a moving average employed in a mean reverting trading strategy[1].

If we plot a Simple Moving Average of period 1931 (in minutes, not hours), we get:


$DWC 1-Minute Data with SMA(1931)

$DWC 1-Minute Data with SMA(1931)


  1. We conducted three statistical tests to ascertain the degree of mean reversion in $DWC 1-minute data, namely Hurst Exponent, Augmented Dickey-Fuller (ADF) and Half-Life of Mean Reversion.
  2. Hurst Exponent did not indicate mean reverting behaviour in the $DWC, but a rather close estimate for possible GBM behaviour.
  3. The Augmented Dickey-Fuller test results indicated stationary behaviour at the 95% confidence interval.
  4. The Half-life of Mean Reversion test indicated $DWC possesses mean reverting properties.
  5. We used the half-life calculated above as the period for a moving average, which when plotted on the chart revealed mean reverting Quote behaviour.

What are your thoughts after reading this research? ..please share in the comments section below!



[1] Chan, Ernest, 2013. Algorithmic Trading: Winning Strategies and Their Rationale, John Wiley and Sons.

Additional Resource: Measuring Investments’ Risk: Value at Risk (VIDEO)
* please activate CC mode to view subtitles.

Do you have what it takes? – Join the Darwinex Trader Movement!

Darwinex - The Open Trader Exchange

Real-Time Trader Sentiment

$DWC – A Real Time Sentiment Index & Security

DWC - Normalized (With Range Boundaries)

DWC – Normalized (With Range Boundaries)

(We recommend you to watch this webinar,hosted by our beloved Integracore2, which is the perfect complement for the article you are about to read)

Fundamental and Technical trading indicators have long been used as a proxy for market sentiment.

But by definition, these indicators have always lagged the movements they’ve been used to forecast.

With the advent of “Big Data”, social data too has joined the ranks, e.g. Twitter, Facebook, LinkedIn, with various attempts being made to harness any potentially predictive patterns through “opinion mining“.


However, Real-Time Sentiment Analysis continues to be an elusive, ever-evolving challenge.

The Challenge: Measuring in real-time, how market participants are presently orientated.

The Solution: DARWIN DWC? ..continue reading for the answer.

If you missed our first post introducing DARWIN $DWC, you may read it here.

DWC – An Index & Tradable Security bundled into one.

DWC is Darwinex Labs’ first attempt at openly addressing the problem of lagged sentiment.

By leveraging community exposure in a manner that protects individual trader IP, DWC shows how the Darwinex trader collective is inclined in real-time.

As a Real-Time Sentiment Indicator, DWC also exhibits the following features:

  1. 24/5 LIQUIDITY during market hours.
    DWC - Instantly Liquid During Market Hours

    DWC – Instantly Liquid During Market Hours


  2. Tradable 24/5 -> the ability to buy into sentiment directly (i.e. buy DWC) eliminates the need for considering purchases of index-linked Exchange Traded Funds (ETFs) or Notes (ETNs) as is the case with say the VIX Implied Volatility Index.
    DWC - Real Time Community Sentiment

    DWC – Real Time Community Sentiment


  3. Cyclical / Mean Reverting -> trading a reasonably predictable, well-defined, mean-reverting price range is high on every trader/investor’s wishlist.
    DWC - Price Quotes

    DWC – Price Quotes


    DWC - Normalized (With Range Boundaries)

    DWC – Normalized (With Range Boundaries)


  4. HIGH CAPACITY – With a current maximum investment capacity of 1.2 to 1.5 Billion USD, there is plenty of retail volume this asset can take to market with little to no market impact -> community IP remains protected at all times, trader/investor interests remain aligned, no conflict of interest.
  5. DWC replicates the opposite of the trader collective’s behaviour – A significant majority of traders routinely demonstrate Loss Aversion (keep losing trades open in confidence that odds are favourable, but close winning trades too soon). The pitfalls of loss aversion make themselves particularly well known during deep market movements. For more details on this, please refer to our first post on DWC.
  6. As DWC replicates the opposite of trader behaviour, it rises during such times.

DWC can therefore be used by Darwinex traders and investors as:

1) A “hedge” during turbulent, deep market movements.

2) A reasonably stable, range-bound asset to trade on its own otherwise.



  1. This post highlighted that the DWC moves with trader sentiment in real-time, realizing progress in “human cognition” led asset management.
  2. Traders stand to benefit from the mean-reverting nature of the DWC offering range-trading and hedging opportunities.
  3. DWC is a sentiment indicator and directly tradable asset.


What happens next?

In future posts, we will commence publishing several streams of quantitative research (e.g. ARIMA/GARCH modeling, deep learning experiments, etc) that we’ve been conducting on the DWC dataset.

Stay tuned!

Webinar Recording: $DWC – Real Time Sentiment Index & Security

Do you have what it takes? – Join the Darwinex Trader Movement!

Darwinex - The Open Trader Exchange