SOM: cooking methods - page 3

 

alexeymosc!

> Made an analysis for the GBPUSD pair on daily bars, 1989 to 2011

[...]

> OOS period (from early 2010 to the present day).


Is this a typo or is it the OSS period that is inadvertently stretched over the analysis period?

 
Ha, good question.
 
It's simple. The network was built using data from 1989 until the end of 2009. And I checked the resulting strategy from the beginning of 2010... Why are you getting so worked up, I don't get it. Repeat the analysis yourself and see for yourself.
 
They'd better say something to the point, they've asked for the data themselves and won't say a word.
 
alexeymosc:
You'd better say something to the point, you've asked for the data and said nothing.


Hello Alexey!

I think a lot of people here are interested in your results. I will try to explain "from my own point of view", so please don't stomp your feet and horns too much!

If we perform the following transformation: Cycle = Close[]-ma(Close[], 25), then we will get a stationary signal (mean = Const, sigma = Const). And we will try to build a trading system on this Cycle using SOM and the same pattern of length 40. We will get a good, robust system... And on a normal price series there are stochastic trends, which are driven by inflation, deflation and other external fundamentals. And these stochastic trends prevent many from getting stable systems. How to deal with them using only the price series of one instrument is not clear to me. And your result on an ordinary price series is quite pleasantly surprising!

 

Thank you! About the conversion I understand. In my case I wanted to squeeze a result out of "just price". Frankly speaking, I was inspired by some comrades, who trade purely on price and successfully (there were such messages on this forum).

I was also a bit surprised with the result, but so far I see some weak points of this strategy, namely drawdown (even on SOM training period) and low trading frequency. It turns out about 250 pips per month. If you run it on multiple instruments, you get, say, 1000 pips a month, but 1) irregular and 2) drawdowns will still grow.

Thinking abstractly, I regard the task of making profit (even if on the paper) in Forex market as a nearly infinite dimensional task. And therefore I try to "poke" in different places of this space, so to speak. Well - sometimes local, imperfect, solutions of the problem come up.

 

alexeymosc, if it's not difficult, please elaborate a bit more, the topic is quite interesting for me. For starters, give me a script with which the data was prepared, or the methodology of data preparation, and by and large I would like to have the final results in mql, and not in exel, if there are problems with switching to mql write, I think we can help, and I'll study NS programming at the same time - I can't figure it out myself, thank you in advance.

 

)) Everything is already in excel ( I've posted 2 archives). I guess I'm just very friendly with it, and I think that's how it is...

But, to the point!

I don't have the script. But it's not hard to implement formation of entries in MQL. We calculate max and min for the last 40 bars by opening prices, including the last completed one. And then we convert the open prices using the well-known formula: (Open-Min) / (Max - Min), thus forming a vector of 40 values with values in the range of [0;1].

Next, I personally would prefer to train SKP in a neuropackage and make a dll-file that would communicate with the Expert Advisor. It's just convenient for me, plus it's convenient to do all analysis in the same Excel. You could go to the trouble of programming SOM training in MQL, this is also an option, but I'm NOT a programmer, I can't help.... I can prepare an Expert Advisor template for the tester, along with a dll-file of the self-organizing map, and we can jointly finalize the code itself and some of the nuances.

By the way, it is not only possible to trade on the daily chart. I got profit on OOS-period even on 15-minute periods), but the drawdowns were large...

 
alexeymosc:

Calculate from the opening prices the maximum and minimum of the last 40 bars, including the last completed bar. Then we transform the open prices according to the well-known formula: (Open-Min) / (Max - Min), thus forming a vector of 40 values with values in the range [0;1].

this is probably the script:

//+------------------------------------------------------------------+
//|                                                     SOM_data.mq4 |
//|                               https://www.mql5.com/ru/users/igorm |
//|                               https://www.mql5.com/ru/users/igorm |
//+------------------------------------------------------------------+
#property copyright "https://www.mql5.com/ru/users/igorm"
#property link      "https://www.mql5.com/ru/users/igorm"

extern int     NumBars = 40;
extern string  FileName = "som_data.csv";

int start(){
   int i,Max,Min,file_handle;
   double _open[];
   double out,max_min;
   ArrayResize(_open,NumBars);
   file_handle = FileOpen(FileName,FILE_CSV|FILE_WRITE);
   if(file_handle<1){
         Print("Файл ",FileName,"не открыт для записи, ошибка №", GetLastError());
         return(0);
    }
    for(i=1;i<=NumBars;i++) _open[i-1] = Open[i];
    Max = ArrayMaximum(_open);
    Min = ArrayMinimum(_open);
    max_min = _open[Max] - _open[Min];
    if (max_min ==0){
         Print("Деление на ноль, невозможно выполнить код");
         return(0);
    }
    for(i=1;i<=NumBars;i++){
        out = (Open[i]-_open[Min]) / max_min;
        FileWrite(file_handle,out);
    }
return(0);
}
//+------------------------------------------------------------------+

the code is a bit long, but should be understandable without comments

SZZ: I'm good with Excel, but very seldom - at calculator level ))))

 

Thank you!

The script works, the values are correct.

I'm thinking about the SOM file now, I'll try to attach it to the EA.