SOM: cooking methods - page 4

 
alexeymosc:

Thank you!

I've asked the old-timers of the forum several times what's up: they sent me to the fakyu and other places to read. In general, I can not do without you - otherwise I will have to do the experiments myself, but "feel" that I want to learn to cook the NS
 

This is how SOM works:

In short: you set the size of the network, for example, we'll always make it square, 5 by 5. Each element is essentially a vector of values, the initial values are best chosen at random from an array of examples (vectors of size 40) that are pre-generated by your script and saved. That is, take 25 random examples from the array (which has a size of say 5000 examples). And then the algorithm is the following: we choose again randomly an example from the training array and compare it with each vector-element of the network (using the Euclidean distance measure? Don't know exactly, maybe something else) The values of the closest vector are corrected by the formula given below. This correction extends to neighbouring vectors too, according to a Gaussian function.

In short, it's complicated... I build NS in a statistical package.

https://ru.wikipedia.org/wiki/%D0%A1%D0%B0%D0%BC%D0%BE%D0%BE%D1%80%D0%B3%D0%B0%D0%BD%D0%B8%D0%B7%D1%83%D1%8E%D1%89%D0%B0%D1%8F%D1%81%D1%8F_%D0%BA%D0%B0%D1%80%D1%82%D0%B0_%D0%9A%D0%BE%D1%85%D0%BE%D0%BD%D0%B5%D0%BD%D0%B0

 
After SOM training, when the error stops decreasing, we take a new vector, compare it with 25 vectors and the one with the minimum error is the winning neuron, if it indicates an entry into the market, then enter, if not, but wait for the formation of the next vector, and so on.
 

If I'm going to trade withalexeymosc , why do you bind to Open price? i think Open and Close are random variables and the fact that your TS shows relatively good results on D1 and worse results on lower timeframes confirms that, to make a trade it is enough to have a forecast of High and Low bar. Can you make an NS using only High and Low ?

And if it's not difficult, can you explain - is it possible to design a NS which would have, say, a 3x5 matrix on the input - 3 TFs and 5 bars, for example?

alexeymosc:

I am building an NS in a static package.

Which package? I have NeuroSolutions 6 and STATISTICA 6 at hand, somewhere else there are distributions, like Matcad - I need to look
 

--- alexeymosc , why do you bind to Open price? imho, Open and Close are random variables, and the fact that your NS showed relatively good results on D1 and worse results on lower timeframes confirms that, for trading it is enough to have a High and Low bar forecast. Can you make an NS using only High and Low ?

I'm not arguing, myself I think that cutting off the price signal with opening (closing) prices is noise and random, but it's just convenient to build the model by opening prices - robust system and makes quick calculations in Metatrader. You can do analysis on High prices as well. I will even do it for your interest and I will post it. I will work with the hour bars, I will take the history from the MT5 terminal, as long as it is available for download.

--- And if you please explain, is it possible to project an NS, that would have a 3x5 matrix on the input, say, 3 TF and 5 bars, for example?

Yes, of course it is. Imagination is unlimited, but the input is always a vector, not a two-dimensional array. More precisely, any two-dimensional, three-dimensional array, etc., is transformed into a one-dimensional vector, for example: the first 5 values are opening prices on the daily bars, the second 5 values are opening prices on 4-hour bars and another 5 values are opening prices on watch bars. And so on... For the NS it doesn't matter in what sequence to give it the data. (The exception is pattern recognition, where it matters and data shifts degrade the result).

--- which package? I have NeuroSolutions 6 and STATISTICA 6 at hand, somewhere else there are distributions like Matcad - I'll have to look

Statistica rules. I use it myself, only on my home computer is version 8. There's an option to upload the NS file as C code, which is commited to the dll and the EA is prescribed to feed the data into the dll and accept the signal.

 
alexeymosc:
More precisely, any two-dimensional, three-dimensional and so on arrays are transformed into a one-dimensional vector, for example: the first 5 values are opening prices on the daily bars, the second 5 values are opening prices on the 4-hour bars and another 5 values are opening prices on the hour bars. And so on... For the NS it doesn't matter in what sequence to give it the data. (The exception is pattern recognition, where it matters and data shifts degrade the result).

Have you checked how important is the order of input data? I want to be 100% sure, because I think that to build an NS on one TF - means to increase the number of input data, which in turn will lead to the TA axiom: "history repeats itself", but alas - history does not repeat itself, the self-deception is something else ;), but if you create a strategy for intraday work, perhaps the use of several TF for training the NS and will give a predictive model with a probability higher than 50%

SZZY: I hope you will be able to create and show the NS using High and Low

 

Let's see, I already started training SOM on hourly bars on High prices for 9 years, from 2001 till April 2010. From May 2010 till May 2011 it will be OOS period. I increased input data vector to 72 (i.e. 3 days). I made SOM size 10 by 10 neurons. it will take a long time to train, it's infected.

I am sure about the order of input variables, I can prove it on the artificial data, but why, it's intuitively clear... We're just dealing with an approximator, a machine.

About the multi-TF strategy, I think there is potential for this idea.

How about installing Statistica 8 to be on the same page?

 

I will look for Statistica 8, version 6 is already standing, if it is not difficult to write in detail the necessary steps for Statistica 8 when creating the NS, there is absolutely no time to learn to work in all programs myself

how do you normalise the input data High and Low?

 

The actions are the same as elsewhere in Statistics 6.

Normalise in the same way, using the formula above.

 

Checked EURUSD H1 as promised. The model was based on High. I was not successful - I lost on the OOS period.

I tested it on hourly bars on Gazprom shares - OOS is on the plus side, quite a good chart.

I also tested an idea to close positions at EURUSD Day1 based on a signal (at transition from one state to another, i.e. at neuron switching). I have made an Expert Advisor, picked up opening and closing neurons using the tester, many profitable runs on the optimization period. On OOS - also a plus.