## Arima-Garch out of the Lab, into Trading

[node:field_image:alt]

#1

Over my last few articles, we have studied the basics of an Arima-Garch hybrid model. In this article, we will review some academic papers, discuss more advanced concepts as well as practical issues in using this technology in trading. We will once again use the rugarch library and the R programming language, so yes you could do this yourself, but almost a year of resources have been spent on this research to create an advanced research tool for Arima-Garch hybrid models. To recap, ARIMA is short for an autoregressive integrated moving average model, and GARCH is short for a generalized autoregressive conditional heteroskedasticity model.

This technology, for example, can produce double buy and hold returns over the past 20 years. This technology is also generic, so it will work on indexes, stocks, exchange-traded funds (ETFs) and futures. Using something called “external regressors” you can even add intermarket analysis to these Arima-Garch Hybrid models.

This can be one of the most important technologies for traders in the modern computer era, on par with spectral analysis and Game Theory in the trading world. The research in this area is just starting as a good percentage of peer review papers on Arima-Garch are less than four years old and some are less than two years old. This will be one of the hottest areas of research for the next five to 10 years. If you don’t look at this technology you will have institutional traders making classic methods untradeable over time. Large institutional traders and hedge funds are researching these methods, your days as a trader may be numbered you don’t at least understand what they are up to.

A year researching Arima-Garch Hybrid models just touches the surface of what they can do. My R program Arima-Garch Professional is the result of about 500 hours of work and its output includes many internal variable and advance features. You could try to develop something like this yourself, but it requires world-class R programming to develop something as robust as my tool. My tool creates five main output files (see “5 outputs,” below).

**Advanced Arima-Garch**

Let’s take a closer look at a more advanced approach to Arima-Garch models. The most common hybrid model for the Arima-Garch hybrid approach is Garch 1,1, which is the standard Garch formula. Through optimization of Arima components we came up with the highest Akaike information criterion or AIC, which is a measure of the relative quality of statistical models for a given set of data (see “Predictive market modeling in R Language,” *Modern Trader* July 2017). Arima-Garch hybrid model is fit to every bar, which is one of the reasons it’s so slow. My later research creates forecasts for up to the next 10 bars without refitting. Often the forecast two days ahead will perform better than next-day forecasts. We saved these results for both mean forecasts, sigma up to 10 steps ahead and AIC (Arima) Garch LogLikelyhood, for each bar. In addition, we also calculate the probability for our forecast, over the next 10 days (see “Calculating probabilities,” below).

The 37-column file can be read in TradersStudio using its user define file option. TradersStudio can also load multiple copies of these created with different Arima-Garch parameters. We can use both the signal file, which produces date, sign and raw prediction files which produce raw predicted returns that can be used in both TradeStation and TradersStudio.

Another advance feature is to use what is called external regressors. They can be used in either or both the Arima part of the equation or the Garch part. My models use the regressor in the Arima part of the model to affect mean forecast returns before we use Garch to correct the errors. This allows us to use intermarket analysis as part of the Arima-Garch models or to add other models to improve our forecasts. For example, how to handle error trapping the rugarch libraries took months to get right; otherwise you would crash the first time you get an error. The program now runs weeks without crashing.

Now that we set all this up and my software makes the job easy, but you could do it yourself, the rest of this work will be done using my Arima-Garch Professional Toolbox Version 1.0. This does all the data handling and as long as you create data definition files you can load the data by only pointing to the directory. We support two file formats, TradersStudio textinfo.txt files and TradeStation’s DOP files, for third-party ASCII data.

In terms of regressor data, we want to be able to handle both data processed with log difference (main data) as well as data not processed at all. We use an R routine to create RDS files. If the file contains more than one column, we take the log differences, if it contains one column, we do not process it and just convert it.

Also addressed in my more complex models are the type of Garch and the order of the garch as well as the distribution used. Valid distributions are: “norm,““snorm,”“std,”“sstd,”“ged,”“sged,” “nig,” “jsu”.

The variance model speciﬁcations: modelValidmodels(currently implemented) are: “sGARCH,” “eGARCH,” “gjrGARCH,” “apARCH” and “iGARCH” and “csGARCH.” garchOrder The ARCH (q) and GARCH (p) orders; fGarch submodels are not supported.

Unlike the work we presented in earlier articles, we are using a backtester, which returns points made not a sum of a log return. Using a backtester allows us to backtest to predict two to three days in the future, not just the next day. Finally, we are saving all of the information produced in fitting the models on each bar, so that we can recreate our analysis as well as run extra-analysis, like the effect of new shocks to our current Garch.

**External regressors & ****intermarket**** relationships**

One of the more powerful parts of the research is to add external regressor to the Arima part of the calculation. This adds the independent variable part to calculating the mean value prediction, the linear component from Arima. You can also add an external regressor to the Garch part, predicting the error, but this is far off as our goal is to predict returns, not volatility.

An Arima model can be considered a special type of regression model. The dependent variable has been stationarized and the independent variables are all lags of the dependent variable and/or lags of the errors — so it is straightforward in principle to extend an Arima model to incorporate information provided by leading indicators and other exogenous variables. These auto-regressors are simply extra terms in the equation, which help reduce the auto-correlated error and further reduce the mean squared error.

In order do this, you would just re-fit the regression model as an Arima model with regressors, and you would specify the appropriate AR and/or MA terms to fit the pattern of autocorrelation you observed in the original residuals.

The question now is, do external regressors help? We need to look at something like R2 or minimum RMS error to see if the regressor helps the forecasts; often they will not, but in some cases it can greatly improve the forecasts. In my research using E-mini S&P 500 (ES) and the SPY index, many different intermarket relationships were used to develop ES/SPY trading strategies. Many different markets, when plugged into my intermarket divergence models, work well, but some of them work poorly as external regressors in the Arima calculation. It also is valuable to create external regressors with custom preprocessing, for example generate trading signals -1,0,1 and use those or lagging the variable to see if the lagged variable are predictive. This is in addition to just using the log difference of the raw data for the external regressor.