Applying the Arima-Garch Trading Model to S&Ps

January 29, 2018 12:26 PM
Advanced Technique

We backtested our Arima-Garch hybrid model discussed last month to the S&P 500. Here is how it did.​

Last month we discussed the complexity required in testing and optimizing Arima-Garch trading models (see “Arima-Garch Out of the Lab, Into Trading,” Modern Trader, January 2018). Here we will run our Arima-Garch hybrid model on the S&P 500. 

We have run a simulation using SPY with a backtest starting on Jan. 1, 1995, running through Sept. 10, 2017, on window lengths of 125-, 250-, 500-, 750-, and 1000-bar periods. We will predict both one and two bars ahead and show the backtest. We will use probability above 50%, and the following distributions: “norm,” ”sged” and it’s sGarch 1,1. Let’s look at a summary of our optimization results on  20 trials (see “Optimization file,” below).

The table includes the market symbol, the run number, trade window length, how many bars in the future we are predicting, distribution, Garch Type and finally backtested results for the number of bars we predicted forward and for a buy and hold strategy. 

Since certain elements remained static—no regressor was used for example— we eliminated some columns for clarity. The optimize file is used to maintain updates and also power some of the utilities which use various files.  You also can use it to look up a give combination and look at the equity curve and files created. 

In the optimization file, trial 19 and 20 had the best performance. They both returned between 270-275 points but number 20 is better because it uses one less year of backtest since it requires 1000 bars, not 750 before its first prediction.  Both 19, 20 are based on a two-step ahead forecast of daily returns. 

An analysis of the backtested equity curve vs. the results of a  buy and hold strategy, which is produced for each trial, shows a positive performance for the strategy (see “Beating the benchmark,” below). 

We will use trial 20 in our analysis and our advance 37 column output. This will allow us to try different probability levels, patterns in the predictions, AIC and loglikelihood to filter our results and try to create better system performance. 

We will then process this output using our advance output file with 37 columns. This includes 10 days of forecasts for both returns and forecast errors, (garch) sigma. In addition, we add forecast probability, AIC and lloglikelihood We will produce both an equity curve and a buy and hold curve for the day ahead we are predicting, in this case. This file does not contain any look-ahead bias. This file has 37 columns and can be loaded as a user defined file in TradersStudio as an independent data series. Multiple files of this type based on different parameters can be loaded into a given session. 

My software also produces a signal file, date, and signal as used in the backtests outputted by the software as well as the raw values that were used to generate the signals. These files can be imported into TradeStation, TradersStudio, TradingBlox, AimBroker or any software that can read CSV files. 

We will use TradersStudio since it can process this extra information.  Here is the simple trading system we are using: 

Sub AGPro_Exp1Simple(ModelNum,DayAhead)

Dim Predict As BarArray

Dim LogRet As BarArray



If Predict>0  And LogRet<0  Then Buy(“”,1,0,Market,Day)

If Predict<0  And LogRet>0   and predict>-998 Then Sell(“”,1,0,Market,Day)

End Sub

The >-998 is used to filter out days which for we have no available forecasts because the Arima-Garch model did not converge. This model is almost identical to one we did in TradeStation using the signal file except for the fact that we are using the advance output file in studio. We are accessing independent1, which is our data file and prediction for two days out.  

Let’s now look at using this trial 20 in TradersStudio. We will use TradersStudio Stock session with dividend calculation on trades along with no slippage and commission. We are also using max bars back 50 bars. Let’s first look at our simple system in TradersStudio and its results. We will use 0 crossing (see “Beginners luck?” below). 


We made $210.42 on the long side and $48.59 on the short side. Long trades had a 69% winning percentage and short trades had a 58.5% winning percentage. The max drawdown is -$32.35 combined and -$35.01 on the long side and -$36.95 on the short side.

The reason we are including this is to show how the extra information in this file can improve results. In my previous article we discussed AIC, we will now use AIC as a filter using as a core the same strategy,  illustrated by the following code: 

Sub AGPro_Exp1AIC(ModelNum,DayAhead,AICLen,AICMult)

Dim Predict As BarArray

Dim LogRet As BarArray

Dim AICBand As BarArray

Dim AIC As BarArray





If Predict>0  And LogRet<0  And AIC<AICBand Then Buy(“”,1,0,Market,Day)

If Predict<0 And LogRet>0 And AIC<AICBand and Predict>-998 Then Sell(“”,1,0,Market,Day)

End Sub

AIC is a negative number normally, it relates to the fit and how complex a model you have. The lower this number is, the better the model. We want to filter out extremely bad models, so we want to filter extreme high values of AIC. If we do this we see a great improvement over the same period. AIC is a relative number so , -3000 on one set of data does not mean the same as -3000 on another; it’s even true over time within the same model. For this reason, we used an upper Bollinger band. If we cross over it we turn the system off. We picked 20 and 1.8 standard deviations. Our new results show improvement (see “Making it better,” right). 

We filtered 60 trades, increased the average trade 31% and increased profit 19%. We made $236.12 on the long side and $73.45 on the short side. Long side trades are 70% correct and short side trades are 59.4% correct. 

Max drawdown is -$32.35 combined and -$40.66 on the long side and -$35.15 on the short side. You can see that using AIC as a filter greatly improved performance. 

This is only a starting point, using the extra information in our advance file combined with simple system can improve performance, so using things like machine learning and combining other technical data and models can really create improvement. Research has shown that external regressors improve results as much as 20% to 30%. You can see that an Arima-Garch based strategy is very computer intensive, but also very promising. Having the right tools and guidance can allow you to add this tool. It’s a tool that large institutional traders are already using, so you will need to add this research to your arsenal if you want to compete and not get left in the dust.  

About the Author

Murray A. Ruggiero Jr. is the author of "Cybernetic Trading Strategies" (Wiley). E-mail him at