Saturday, December 22, 2007

Neural Networks


Necessity is the mother of invention. In the last couple of days I've taught myself how to use neural networks to forecast time-series. Very helpfully, the econometrics package I am using - RATS - has a built in neural networks module, which is pretty easy to use. Reading some online papers by econometricans got me to see through the rather esoteric language used to understand that these are basically a specific type of non-linear regression model that isn't too far from some of things I've used in my academic research. I experimented with trying to forecast the stochastic oscillator but couldn't get anything better than I could with simple time series models. Now I am "training" a network to forecast changes in the NASDAQ 100 index using all the indicators that my existing model produces. The problem with the existing model is that there are several different indicators (there are three actual time series models for each index). Sometimes the direction is clear but a lot of the time, different indicators point in different directions. I've gradually developed ad-hoc rules for how to interpret the indicators in different situations but it is then very easy to second-guess and make mistakes. The neural network finds the best rules it can given the structure of neural net (explanatory variables, number of neurons etc.) and provides a simple long, short decision. So far the results are extremely good, but this is early days. Using this approach would add another layer of models to run every day but reduce the amount of time needed observing the market etc wondering what to do and whether the right decision was made.

In my simulated trading this week I did really well trading the Australian stock index futures (SPI) but not well trading the Nikkei. I think though I am beginning to get the hang of how to day trade the Nikkei.

Overall, it feels like I made progress this week, which is good.

2 comments:

Anonymous said...

Having spent a lot of time on neural net modeling, a few hints:

1. It is all about the inputs. If your inputs don't have genuine predictive value, then your models won't either.

2. Beware of curve fits. Make sure your models work on out-of-sample data.

3. Your models will only be useful for a while. Figuring out when a model is at the end of its useful life versus just going through a period of drawdown is a problem.

4. The better the model (in terms of percent of potential gains captured), the less time it will last. The markets are statistically non-stationary, as I'm sure you know.

I eventually gave up. (3) was the killer for me. Good luck.

mOOm said...

Thanks for these useful comments. I've already encountered #2. My first attempt produced unbelievably good results until tested out of sample, then I realized I was "overfitting". I need to use a longer time period of data and less variables I think. I'll use just the variables that I am currently using to forecast and a much longer period for "training".