AForge.NET

  :: AForge.NET Framework :: Articles :: Forums ::

Genetic Algorithms and Financial Time Series

The forum is to discuss topics from different artificial intelligence areas, like neural networks, genetic algorithms, machine learning, etc.

Genetic Algorithms and Financial Time Series

Postby pauluk » Sun Feb 07, 2010 10:25 am

Hi Andrew,
First thanks for a great set of classes. I am currently using the Genetic Algorithm routines and I have a question about using them with a financial time series of (for example) Futures end of day closing prices.

I have looked at the code for the Time Series example application and it appears to be evaluating "in sample" data for the prediction period e.g. the last 5 values to be predicted are being evaluated then recalculated using the bestFunction and the result presented side by side to the original price.

My question is how can create a "query" for a GA where I present it with sequence of (for example) the last 500 closing prices and get it to predict the prices for the prediction period - is this possible?
Thanks,
Paul.
pauluk
 
Posts: 1
Joined: Sun Feb 07, 2010 10:04 am

Re: Genetic Algorithms and Financial Time Series

Postby andrew.kirillov » Mon Feb 08, 2010 10:51 am

Hello, Paul

Not really sure if I understood you completely … But I though that the sample given with the framework is supposed to do what you need (with some modifications of course, since it is just a sample). In the sample you may load data of any length. Then you may define training window size – number of past values to use for prediction next. Yes, the sample does not do prediction of future values. It just does not use few last points during learning and then predicts them, so you could compare with real data. But the code should be quite easy to read and modify.

Warning. Please, do try using this simple sample with real data and predicting something like Forex. It is common mistake of many people who were writing to me. IT IS JUST A SAMPLE FOR GA AND GEP. Real data are much more complex and require more sophisticated algorithms or their combination.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3427
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: Genetic Algorithms and Financial Time Series

Postby nickka » Tue Feb 22, 2011 9:08 pm

Andrew,

I too want to predict future stock prices from historical stock prices. To be honest, I see no value in the Time Prediction application if it does not predict future values.

Here is what I would like to do:
    Load 1 year's historical stock close prices
    Run Genetic Training to get the best solution
    Plug in values from that best solution to predict future stock prices

What values would I use from that best solution to plug into the calculation for future stock prices?

Is there a way to set up the application or the data to predict future values or are you talking about code modifications? Hopefully you can go into some detail about the best way to do this.

I am an experienced C# developer, so feel free to go into some detail if you like.

Thanks and keep up the good work!
nickka
 
Posts: 1
Joined: Tue Feb 22, 2011 8:41 pm

Re: Genetic Algorithms and Financial Time Series

Postby andrew.kirillov » Wed Feb 23, 2011 10:38 am

Hello,

nickka wrote:To be honest, I see no value in the Time Prediction application if it does not predict future values.

1. That application is just a SAMPLE of using Genetic Programming and Gene Expression Programming. It was never supposed to become a real application which does future prediction.

2. Prediction of times series is a very broad topic, which is beyond the AForge.NET framework. So you better study it in details, rather than trying to make something quickly. There are many ideas about how to approach the problem and it was never said that the one chosen in that SAMPLE is the best approach.

3. The application was never supposed to bring value to you as it is. It was supposed to give you are SAMPLE.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3427
Joined: Fri Jan 23, 2009 9:12 am
Location: UK




Return to Artificial Intelligence