Dynamic WARIMAX-gjrGARCH Market Strategy


In this article, I am going to explore an alternative forecasting technique that currently has merits in the field of dam displacement, a structural engineering problem. I will then apply this technique and measure its forecasting capability on the S&P/TSX Composite Index (GSPTSE).

The model is the Wavelet Auto-Regressive Integrated Moving Average model with eXogenous variables and Generalized Auto-Regressive Conditional Heteroskedasticity. I am by no means a subject matter expert in the field of structural engineering, but the results in the original paper conclude that the precision and accuracy of the WARIMAX-GARCH model are quite robust over that of an ARIMA-GARCH model, at least when applied to dam displacement data. The basic idea of the model is to decompose a given time series into what are called wavelets. Coming from the field of signal processing, wavelet decompositions are a class of techniques used to model noise from a dataset. Without becoming too technical, wave functions (combinations of trigonometric functions) are used to represent the noise. These functional identities are known as wavelet components. In terms of the new model, these wavelet components are then used to construct exogenous variables to be fed into a regular ARIMA-GARCH model along with the original data.

From Engineering to Finance

Financial time series data tend to exhibit serial correlation and volatility clustering. These phenomena can lead to biased, inefficient, unstable, and spurious regressions and estimates. It would be highly unreasonable to try and forecast a time sereis exibiting these issues. People would be fired. Luckily, models such as ARIMA and GARCH can be used to solve these issues respectively. The true beauty of these models is that they are easy to use and they are linear only in past values of a single variable. The basic representation is as follows:


Where P is a time series of prices, y and sigma is the conditional mean and variance of each observation in the series. The general form of y is modeled by (2), an ARIMA(p,d,q) process, and sigma is modeled by a GARCH(p,q) process.

Forecasting a univariate time series such as ARIMA-GARCH is notoriously difficult, especially when it comes to predicting future market returns. Factors such as interest rates, corporate fundamentals and politics are but a few of the variables that can influence the return of a financial asset. The existence of exongenous variables creates the problem of non-linearity. In other words, the returns of an asset are not strictly dependent on its past values, which is the exact premise underlying ARIMA-GARCH! To tackle this problem, a new model is constructed that makes use of the wave-let idea as an exogenous variable. An WARIMAX(p,d,q) model will address the problem of non-linearity. To model the volatility characteristics, he gjrGARCH(p,q) model will be used. The gjrGARCH allows downside volatility to persist longer than upside volatility, a vast feature in financial time series.

The WARIMAX-gjrGARCH model and strategy

The construction of this model is straightforward. Equations (1) and (2) are adjusted to consider exogenous variables. The structure allows for many exogenous variables, but for the purposes of this model only one shall be used. The eta term in (2) is replaced in (5) to account for the leverage effect in financial time series. Hence, (5) is out gjrGARCH representation.


The exogenous variable is constructed by creating a new series from the original data. A simple ARIMA-gjrGARCH model is used on the underlying series. This will have the effect of “de-noising” the series and thus producing a series where each observation is the sum of the conditional mean and variance. This “wavelet” series is then fed into an ARIMA-gjrGARCH as an exogenous variable along with the original time series. The model asserts that future returns can be explained by past values of the de-noised representation of the original series, the original series itself, and variance.

To see if the WARIMAX-gjrGARCH model should be explored beyond this article, I intend to back test its performance against the S&P/TSX Composite Index (GSPTSE). Its performance is also compared to the simple ARIMA-gjrGARCH strategy in two different regimes; 2007-2009 (recession) and 2015-2018 (normal).

The main objective of the trading strategy is to use the WARIMAX-gjrGARCH model to forecast the 1-day ahead return of GSPTSE. The model uses two years of data. All data to make a forecast tomorrow is available today, so there is no look-ahead bias. If the model forecasts a positive return then a long position will be taken in GSPTSE. The market will be exited should there be a negative or statistically insignificant forecast.

The log-difference of the GSPTSE daily closing price series is used and was retrieved from Yahoo finance from 2003 through to 2018.

I have no included any statistical tests in this article, but even by inspection it can be seen quite clearly that the series does exibit volatility clustering over time. Below shows the intended back test period. In other words the forecasts will be collected and tested against through the green window. The two periods is what I class as recessionary and normal.

With the back test windows being specified. The next step is to de-noise the series to create the exogenous variable. As was said before, a simple ARIMA-gjrGARCH model is applied. For this procedure I use two years worth of data. Since a new variable is being created everyday starting with the previous 500 days, it is necessary to account for this relative to the back test window. The figure below shows this. The area in red shows the data window that must be chosen to generate the first exogenous variable of the series. The area in purple is the length of the actual series.

To implement the model with exogenous variables, the series length of GSPTSE returns must be equal to that of the exogenous variable . The length of each series is approximately two years before the back test windows. Now I can start training the model with two years of initial data, rolling through the back test period. To generate each forecast, the environment is set up so that the order of ARIMA is chosen to minimize the AIC. In fact, because returns are being modelled, we are implicitely using an ARIMA(p,1,q) model on P rather than y. This is the same as applying an ARMA(p,q) on y. To model the volatility process a gjrGARCH(1,1) is used. The idea of selecting this order is based largely on the literature. Degiannakis and Xekalaki (2007) suggests that it isn't possible to find the best volatility model in-sample. So and Yu (2006) also say that higher order GARCH models don't add that much more precision in forecasting. To save on electricity, I've decided to just use order (1,1).


Lets first analyze the results of the strategies within the recessionary period. The figure and table below show the backtest results and the strategies descriptive statistics:

Plotted is the growth of a $10,000 dollar investment between three standalone strategies: long the S&P/TSX Composite Index, the ARIMA-gjrGARCH strategy, or the WARIMAX-gjrGARCH strategy. Overall the simple ARIMA-gjrGARCH strategy performs the best of all three strategies. It has the highest Sharpe Ratio (a measure of return per additional unit of risk taken). A negative Sharpe ratio implies that a long investment in the risk-free rate is more profitable than the strategy. A risk-free rate of 0.25% is used. A Sharpe Ratio of less than 1 means that the expected risk of taking on the strategy is higher than the expected excess return. So none of these strategies are compensating for the amount of risk taken. To measure strictly downside risk, the Sortino Ratio is included. The Sortino Ratio is higher for the ARIMA-gjrGARCH strategy, meaning that there has been less downside risk relative to the other strategies. Beta is also included to account for correlation with between the two strategies and the TSX. I’ve calculated the hit rate as well for the two ARIMA strategies. Hit rate tells how often the model is correct in it’s predictions. There are 756 opportunities for the model to make a prediction. If the model predicts an up (down) movement tomorrow and tomorrow the market goes up (down), then the model is correct. If the model predicts a down (up) movement tomorrow and tomorrow the market goes up (down), then the model is wrong. I classify a binary array of length 756 with either 1 or 0, correct or wrong respectively. Below is the formula:


Where s is the indicator of 1 or 0, the movement success or not. The hit rate for the gjrWARIMAX strategy is higher. This is likely due to the increase in growth of this strategy during the first 18 months and during the last 6 months. The gjrWARIMAX seems to fail greatly during the extreme volatility period starting June of 08 and lasting about a year. The simple ARIMA model performs similarly during the recession, but picks up after the bottom. It’s important to remember that these classes of models were designed to consider periods of extreme volatility.

Since the ARIMA-gjrGARCH model is using very volatile data to produce estimates, it will outperform after the bottom hit. When the model is applied to a not so volatile period, it fails. On the other side of that, the WARIMAX performs the opposite. It tends to underperform with periods of extreme volatility, but it performs quite well when volatility is less extreme. The table finally also shows the maximum drawdown for all three strategies, WARIMAX actually being the lowest.

Let’s now turn to analyze how these strategies perform in a normal market environment. The next figure and table shows the performance and statistics of the strategies over a three year period starting in 2015.

It can be seen that the WARIMAX-gjrGARCH strategy returns 14.36% over the testing period. The Sharpe Ratio for this strategy and is highest. Since the ratio is higher than one, the strategy is compensated relative to the risk taken. Sortino Ratio is also highest for this strategy. Betas have been included for reference. Hit rates are also shown. While it’s true that this hit rate for the WARIMAX-gjrGARCH strategy is only about 52%, it cannot be concluded that this strategy is near a random (50/50) strategy. If a strategy has 50/50 chance of being wrong on a given day, as long as the upside return is greater than the downside, the strategy will not lose money in the long term. This idea can especially be measured by the sortino ratio, telling us that the downside risk, or losses, is less than the upside gain relative to the other strategies. The WARIMAX-gjrGARCH strategy also has a lower maximum drawdown.

Costs and benefits of using these models

The real benefit of using either ARIMA-gjrGARCH or WARIMAX-gjrGARCH models is that they are very easy to implement and only require one variable for analysis. Additionally, all of the data used to forecast tomorrow’s movement can be verified today, eliminating any look-ahead bias. While it is true that these models perform well in certain environments, they are far from perfect. The most obvious flaw is that the strategy runs on an index. Indicies are a statistical measure of how well a basket of securities are doing and is not directly tradable. To put this strategy into practice, back tests will have to be run on a traded security. Specifically, Index exposure can be gained through exchange trade funds, ie ticker XIC. Furthermore, the strategy doesn’t take into consideration transaction costs such as brokerage fees and slippage. Other exogenous variables could also be used, but they would have to be structured such that there is no look-ahead bias. Lastly, the strategies are long only. This means that there are only three options; buy, sell, hold. There is no shorting or leverage involved here. Doing so may actually enhance the portfolio strategy.


An alternative approach to an ARIMA-gjrGARCH model is the WARIMAX-gjrGARCH model. The hypothesis is that if exogenous variables are considered in a ARIMA-GARCH model, better forecasts can be obtained. Rather than using exogenous macro variables such as interest rates, the original series is de-noised (inspired by the Wavelet Decomposition) to create a series where each data point is a proxy for the conditional mean and variance at that point in time. This new series can now be added into the ARIMA-gjrGARCH model as an exogenous variable, hence the WARIMAX-gjrGARCH model. It is hypothesized that the model will forecast a return based on an original noisy dataset (the returns) and the “cleaned” dataset (the exogenous variable).

The conclusion is that the ARIMA-gjrGARCH model outperforms WARIMAX-gjrGARCH during times of high volatility. This makes sense since ARIMA-GARCH must feed on volatility clusters to be meaningful. During periods of lower relative volatility, but still some clusters, WARIMAX-gjrGARCH will outperform ARIMA-gjrGARCH. So I would caution the use of WARIMAX-gjrGARCH over regimes that are deemed to be crises, however, use during normal growth periods provides better performance over the vanilla strategy.

Given these results, the next steps will be to implement the strategy using a tradable security or a portfolio thereof. It would also be useful to combine these strategies into a single portfolio. Rules could then be defined that allows for the switching between strategies based on a regime change.