SOM: cooking methods

 

Good afternoon!

I've been approaching the use of self-organizing maps in Forex for a long time now. I decided to make an experiment: I have taken daily bars from 2001 till the end of March 2011, built input vectors for a neural network with size 40 and trained SOM with size 7 by 7 neurons, thus splitting vector space in 49 cells. Then for each cell, I calculated the probability of a price move up or down in 5 bars. The result of the analysis is shown below:

Further, we select clusters that are interesting from the practical point of view. Clusters highlighted in yellow mark the Buy entry points. Orange are Sell entry points (there are less of them, as apparently EURUSD has been dominated by uptrends for the last 10 years).

The next step is to implement the strategy in Excel according to an uncomplicated formula. The strategy is simple, buy and hold or sell and hold. The transaction duration is 5 bars, and for each transaction I have introduced correction (spread + swap) of 0.0005 (5 four-digit points), as each transaction will hang through the weekend...

Below is the resulting balance chart on the SOM study period (640 trades over 9 years):

And now...

- Balance chart on OOS period - last year (66 trades, about 400% profit):

It is possible to implement in MT4, SOM to train in statistical package and connect via dll, get cell number from network and enter in buy, sell, or wait.

What do you think? I am confused by large drawdowns. A whole quarter may go down. And the strategy is pretty primitive.

 

Kohonen Maps can be easily implemented in any programming language, including MQL4

No library is needed

 

Strange, I did something similar - it didn't work - there was a drain on the feedback.

Can you give a concrete example of input/output shaping?

One of the projects is correlating now anyway... we could try Kohonen's at the same time.

 

What does "probability of a move up or down" mean? Just that the price in 5 bars is more likely to be up (down) from the current one?

What kind of network do you have? Is it single layer, double layer? 40 is the size of what?


Just a quick guess... a network of 40 inputs cannot be trained on such a small amount of data (that's putting it mildly). The map above is not reassuring :) There are no clusters on it in general. Your result is a fluke.

 
Vinin:

Kohonen Maps can be easily implemented in any programming language, including MQL4

The library is not needed


Thank you! I will be aware of that. In general, I wanted to discuss more the merging of this method with a trading strategy and the specifics of Kohonen Maps in relation to forex quotes or any other financial markets, rather than the ways to implement Kohonen's ACS in Metatrader.

TheXpert

Specifically, I input the last 40 open prices of daily bars, but not in raw form, but scaled up to avoid non-stationarity of price level. I don't use output variables for SOM training, but the idea is that when I analyze samples broken down by cells I look to see if the opening price on the fifth bar will be higher or lower than the last known open price in the future.

Diamant

How can you be so sure of the randomness of the result? Did you enter this thread to make a stupid argument?

What do you mean by little data? How much is it? How much is enough?

 
alexeymosc:

Specifically, the input was 40 last opening prices of daily bars, but not in raw form, but scaled to avoid non-stationarity of the price level.

And can you feel these very inputs?

No output variables were used to train SOM, but the idea is that when analysing the samples, broken down by cells, I look at whether the opening price on the fifth bar in the future will be higher or lower than the last known opening price.

In your table, the sum for the cluster is not 100%, i.e. besides a simple above/below comparison, is there something else - spread accounting?

 

On inputs, ok, I'm at work now, as soon as I'm free - I'll send an excel in the archive (in private)).

The sum is not equal to 100% - true, and here's why: I did the following calculation: if Open [t+5] - 0.0010 > Open [t] 1 else 0. That is, the analysis includes cases when the price in the future is at least 10 points higher than the current one. The same was done for the analysis of a downward price movement (10 pips threshold).

 

OK, thank you. I can't promise it'll be quick, but I'll have a look.

Yeah, that's kind of what I had in mind.

 
alexeymosc:

I'm at work now, but I'll send you an excel file as soon as I'm free (in a private message).

And may I also? Or you can just drop it here, if it's not too much trouble.
 
It would be better to upload the archive here
 

Well, I don't mind if you have a desire to get to know the work.

It would be good to improve the system in some way.

Files:
Reason: