Levenberg-Marquardt algorithm

To add comments, please log in or register
smotty
100
smotty  

Anybody know anything about the Levenberg-Marquardt algorithm and neural networks to predict future forex price movement

http://www.cs.adfa.edu.au/~ruhul/Joarder.pdf

check out the above paper and the predictions of the computer model

compared to the actual data on page 10. (They look pretty accurate to me)

If any one has any ideas or knows anything about this perhaps they could let me know!!

dellan
212
dellan  
smotty:
Anybody know anything about the Levenberg-Marquardt algorithm and neural networks to predict future forex price movement

http://www.cs.adfa.edu.au/~ruhul/Joarder.pdf

check out the above paper and the predictions of the computer model

compared to the actual data on page 10. (They look pretty accurate to me)

If any one has any ideas or knows anything about this perhaps they could let me know!!

it might be very usefull for us!

i will seach if anyone knows how to use this on forex

smotty
100
smotty  

Hi Dellan if you know of anyone I would be very interested in trying to take this further

snowleopard
23
snowleopard  

I know a little bit about this. What do you mean by taking this further?

smotty
100
smotty  

Hi Snow

By take it further I mean to find or write a program that predicts currency movements using this algorithm.

I unfortunately don't have a degree in maths and am a novice programmer, but if the paper is correct and his model predicted the movements that closely then surely there is some merit in producing a trading system based on this.

silverpike
15
silverpike  
smotty:
Anybody know anything about the Levenberg-Marquardt algorithm and neural networks to predict future forex price movement

http://www.cs.adfa.edu.au/~ruhul/Joarder.pdf

check out the above paper and the predictions of the computer model

compared to the actual data on page 10. (They look pretty accurate to me)

If any one has any ideas or knows anything about this perhaps they could let me know!!

I am very glad you posted this. Nobody on this forum knows me, because I don't post here. But I decided to reply here to tell you guys what I know.

I saw this paper about 2 days ago when smotty posted it for the first time (great find!). I was immediately intrigued, because I am a programmer, and I know neural networks. Additionally, the paper says they used Matlab to generate their results, which I have also used for various academic reasons. I had long been thinking about using neural nets for prediction, but I was always under the impression that they weren't very successful. However, the results in this paper suggested otherwise. I decided to try and replicate their results.

In some ways I was successful, but in the most important way, I was unsuccessful (let me explain). I figured out that partly due to the way the authors tested their network and partly due to the way Matlab tests neural nets, the results are highly misleading. I was able to mostly replicate the results the authors show on Page 10 of their paper, but it really doesn't mean much. You can see in my attachment what my results are, which look very similar to theirs. I will attempt to explain what's going on here.

First, for people that know, I will explain my methods. I highly suggest you read the paper before you read the rest of my explanation, or else it will be confusing. I used the parameters specified in the paper, and I found experimentally that their reccomendations were indeed optimal. I used a 3 layer feedforward backpropagational network. The first layer had 6 input neurons, with 5 in the hidden layer, and 1 to generate the output. The output was the next week's target price. I used the same 6 inputs from the paper: 5 different moving averages and the current week close. I used scaled conjugate gradient network training, with normalized MSE error measurement. I used historical weekly data for GBPUSD obtained from Dukascopy, which totalled 391 weeks. I wanted more data, but no more than this was available from Dukascopy, so I was stuck with 391.

To test it, I trained the network on the first 351 weeks, and tested it against the last 40 weeks to see how it would do. Using the "Matlab method", it appears very accurate. The picture I have attached was from a 351-week training, and applied to all 391 weeks. The blue line was the actual close price, and the green dotted line was the neural prediction.

Ok, now for the problem. The way this neural network works is that it is supplied with 6 different parameters at the same time. It is not sequential, which means it does not require a set-up of internal state (beyond the initial learning). It does not depend on past price behavior, only the immediate 6 inputs. Once trained, it will take in 6 inputs and generate a single price target for the next week. Because of this, the graph generates only single "next-week" values. That is, it generates the next values one at a time, not in a sequence. What you see on the graph are not extrapolated as a series, but one-at-a-time predictions on an every-week basis. Said differently, this prediction is valid for one week only. After the week is up, actual data is then fed back in, and a new single week prediction is generated. The results are then plotted.

Predicting one week ahead is nice, but not really what we want. I am looking for an arbitrarily long future prediction. Naturally, something reasonably small makes the most sense. No network is going to generate an accurate prediction for 100+ weeks. But I was hoping to see something decent for a period of roughly 40 weeks. Therefore, I wrote my own piece of code for Matlab which takes the next-week price prediction generated by the network, and then feeds that back into the next iteration's input, along with appropriately calculated MAs. In summary, the network's own forward predictions will be used as the basis for it's next-week prediction. If this is done many times in sequence, then a true future sequence can be created.

The dissappointing part is this network-generated prediction sequence. I found little to no correlation with actual data when this is done. I strongly believe that the paper authors didn't understand this, which is why their results are less than useful. I did see some correlation over roughly the first 10 data values. Just FYI to the readers here, this network predicted a continued fall in GBPUSD, down to roughly 1.84 (possibly below) using this method.

Anyways, I hope this info is useful. This isn't the holy grail it appears to be on paper. However, I will continue to play with it. I am also interested in creating a neural net for daily price targets, and see what that generates.

Files:
400weeks.jpg 77 kb
silverpike
15
silverpike  

I did some googling, and I just found another paper that deals with this subject.

http://citeseer.ist.psu.edu/yao00case.html

It is clear from reading it that this paper is much more comprehensive than the original. It also appears that smotty's paper (Joarder) is a less-thourough attempt to piggyback off this one. The paper by Yao basically confirms my suspicions. The Joarder paper isn't worth much IMHO.

dellan
212
dellan  

silverpike, i think if you try do make the predicitions daily, the target will be more sucessfull, in long term, the market is more unpredictable!

anyway, this algorithm should be a future holy grail if we can optimizing this or discover some way to get the best results, but for this, we need more people understanding this (i need too).

another thing, your image shows a great prediction! IF the method do the next week sequence with the own actual data (from the actual week predicion), why don´t you get the real data of the actual week and do another week prediction withe this real data?

i understand you want do predict in long terms, but if you do predicition week by week based on real data you can get it with more precision, so the error rate is lower

thanks

snowleopard
23
snowleopard  

Hi everybody, and thank you for interesting discussion. First, all that we have in the so called neural predictor is a kind of moving average, i.e. a lagging indicator. Take a look at the charts in the Jourder paper, and you'll see what I mean. So, in other words, a neural predictor could be called a nonlinear adaptive moving average - it's better than any linear type moving average but that's about it. The belief that least-squares optimisation over the past can predict far out in the future is simply unfounded, so to keep the prediction at one time-step is a good idea.

Second, we have only talked about prediction so far, and we need to get from that to a trading strategy. As we have a lagging moving average type indicator, the strategy will have to be of the ma-crossover type, as Yao et al realised. Take a look in chapter 11 of "An Introduction to High-Frequency Finance" by Gencay et al for the details on how it's done in the big banks. The summary is that it can be done, it's good, but not the holy grail, and never will be. If you're interested and don't have access to the book, I could try to summarise here.

dellan
212
dellan  
silverpike:
I am very glad you posted this. Nobody on this forum knows me, because I don't post here. But I decided to reply here to tell you guys what I know.

I saw this paper about 2 days ago when smotty posted it for the first time (great find!). I was immediately intrigued, because I am a programmer, and I know neural networks. Additionally, the paper says they used Matlab to generate their results, which I have also used for various academic reasons. I had long been thinking about using neural nets for prediction, but I was always under the impression that they weren't very successful. However, the results in this paper suggested otherwise. I decided to try and replicate their results.

In some ways I was successful, but in the most important way, I was unsuccessful (let me explain). I figured out that partly due to the way the authors tested their network and partly due to the way Matlab tests neural nets, the results are highly misleading. I was able to mostly replicate the results the authors show on Page 10 of their paper, but it really doesn't mean much. You can see in my attachment what my results are, which look very similar to theirs. I will attempt to explain what's going on here.

First, for people that know, I will explain my methods. I highly suggest you read the paper before you read the rest of my explanation, or else it will be confusing. I used the parameters specified in the paper, and I found experimentally that their reccomendations were indeed optimal. I used a 3 layer feedforward backpropagational network. The first layer had 6 input neurons, with 5 in the hidden layer, and 1 to generate the output. The output was the next week's target price. I used the same 6 inputs from the paper: 5 different moving averages and the current week close. I used scaled conjugate gradient network training, with normalized MSE error measurement. I used historical weekly data for GBPUSD obtained from Dukascopy, which totalled 391 weeks. I wanted more data, but no more than this was available from Dukascopy, so I was stuck with 391.

To test it, I trained the network on the first 351 weeks, and tested it against the last 40 weeks to see how it would do. Using the "Matlab method", it appears very accurate. The picture I have attached was from a 351-week training, and applied to all 391 weeks. The blue line was the actual close price, and the green dotted line was the neural prediction.

Ok, now for the problem. The way this neural network works is that it is supplied with 6 different parameters at the same time. It is not sequential, which means it does not require a set-up of internal state (beyond the initial learning). It does not depend on past price behavior, only the immediate 6 inputs. Once trained, it will take in 6 inputs and generate a single price target for the next week. Because of this, the graph generates only single "next-week" values. That is, it generates the next values one at a time, not in a sequence. What you see on the graph are not extrapolated as a series, but one-at-a-time predictions on an every-week basis. Said differently, this prediction is valid for one week only. After the week is up, actual data is then fed back in, and a new single week prediction is generated. The results are then plotted.

Predicting one week ahead is nice, but not really what we want. I am looking for an arbitrarily long future prediction. Naturally, something reasonably small makes the most sense. No network is going to generate an accurate prediction for 100+ weeks. But I was hoping to see something decent for a period of roughly 40 weeks. Therefore, I wrote my own piece of code for Matlab which takes the next-week price prediction generated by the network, and then feeds that back into the next iteration's input, along with appropriately calculated MAs. In summary, the network's own forward predictions will be used as the basis for it's next-week prediction. If this is done many times in sequence, then a true future sequence can be created.

The dissappointing part is this network-generated prediction sequence. I found little to no correlation with actual data when this is done. I strongly believe that the paper authors didn't understand this, which is why their results are less than useful. I did see some correlation over roughly the first 10 data values. Just FYI to the readers here, this network predicted a continued fall in GBPUSD, down to roughly 1.84 (possibly below) using this method.

Anyways, I hope this info is useful. This isn't the holy grail it appears to be on paper. However, I will continue to play with it. I am also interested in creating a neural net for daily price targets, and see what that generates.

to make this image, you have generated next week graph , and then waaited for the next week finish to get the real graph, and then compared the two graph?

if you did this, this should have a very good precision

smotty
100
smotty  

Hi Silverpike and snow for your excellent responses that was just what I was looking for.

I don't believe there is a holy grail in trading either, as everyone would be doing it, but have I understood your findings correctly that your model accurately predicted price over a period of a week.

Surely this could be made into a trading system, especially as I rarely hold a position longer than that anyway.

Is is not as simple as your model predicts eg cable will drop to price x and at the beginning of the week you sell and then use pivots fib resistance etc or the price predicted to exit.

Imagine the profits you could make with a system accurately predicting daily or weekly prices to say within 20% of the real price!!

123
To add comments, please log in or register