What to feed to the input of the neural network? Your ideas... - page 50

 
Ivan Butko #:

On the example of one of the sets:

It can be seen that the takers are short, and the elbows are stronger. If it over-sits, it leaves green "snot" in the form of equity sagging. But if it finds a good point on the chart, it can close in time and thus show some stability

Optimisation - year: 2021-2022, EURUSD H1

Thank you for your research and developments (for sharing them) - very interesting... re-reading them (I am in the subject myself) makes me want to continue exercises with them (NS)... :-)

 
Roman Shiredchenko #:

Thank you for your research and developments (for sharing them) - very interesting.... rereading (myself in the subject), there is a desire to continue exercises with them (NS)... :-)

Thank you for your feedback.

I have a branch of simple NS, made on my knee, based on simple articles here, https://www.mql5.com/ru/articles/497, here more complicated https://www.mql5.com/ru/articles/5486, and this one I sometimes use https://www.mql5.com/ru/articles/830

Expert Advisors, which I modify to fit the ideas - also from there.

Despite the fact that there is no sure-working solution, the experiments are fascinating.


Нейронные сети - от теории к практике
Нейронные сети - от теории к практике
  • www.mql5.com
В наше время, наверное, каждый трейдер слышал о нейронных сетях и знает, как это круто. В представлении большинства те, которые в них разбираются, это какие-то чуть ли не сверхчеловеки. В этой статье я постараюсь рассказать, как устроена нейросеть, что с ней можно делать и покажу практические примеры её использования.
 
Ivan Butko #:

What is also potentially good is the intraday size of the trades: at least they are not single candlestick trades, but are sometimes stretched over time. Besides, trades are traded both ways, BUY and SELL. The eternal problem of approximation (if I use the term correctly) is that NS chooses which trades earn the most and builds weights for them. As a result - if the trend on the optimised section is down, and one third of its section is up, then global subsidence occurs on the forward or backing.

I think this is not the eternal problem of approximation, but the eternal problem of classification on the output layer. It is good that it does not manifest itself in this case.

 
Andrey Dik #:

I think this is not a perennial approximation problem, but a perennial classification problem on the output layer. It is good that it does not appear in this case.

What is the mechanism of the phenomenon?

Why does the MT5 optimiser choose such weights that refuse to trade in buy on a long-term period (in which there are many upward trends - this is idle time, potential profit, you need to explore this area), and trade only in sell.

Not all the sets, but the top ones, which seem to be the most important. When you start it, there are only sells. Although the sets that are at the bottom are trading both ways, but badly.

 
Ivan Butko #:

And what is the mechanism of the phenomenon?

Why does the MT5 optimiser choose such weights that refuse to trade in buy on a long-term period (in which there are many upward trends - this is idle time, potential profit, you need to explore this area), and trade only in sell.

Not all sets, but the top ones, which are the most important. When you start it, there are only sells. Although the sets that are at the bottom are trading both ways, but badly.

The mechanism is quite simple.

The first factor: I see that training takes place on EURUSD, and on it sells are more profitable with all other things being equal (I have noticed it many times on different TSs).

The second factor, more important: the fitness function does not take into account the ratio of buy/sell, the signals "roll" towards sell as more effective and eventually leads to a complete absence of buy (on other symbols there may be a roll towards buy).

That is, we need to understand what exactly NN is learning, and the criterion of its learning is always the fitness function. The logical step is to multiply the custom criterion by the min/max ratio, where min is the minimum number of buy or sell trades and max - vice versa, respectively.

FF = Fcustom * MathMin (buys, sells) / MathMax (buys, sells);

Now we see that if there is 100% skewness, such FF will be equal to 0, and other things being equal, the best value will be the one where the number of directions in both directions is the same.

This, of course, is not a panacea, but it is definitely worth a try.

By the way, this is one of the ways to change the shape of the FF surface so that the desired optimum would be global for unambiguous interpretation.

To additionally stimulate learning towards a greater number of trades, you can do the following:

if (FF == 0) FF = -DBL_MAX;
 
I was browsing on some old site, an article from 10 years ago about neural networks in forex.

They suggest to input... the angle between Close N candles back and the current price.

It's crazy, but I like it!


I haven't tried it yet, but I will definitely try it, as soon as I understand how to find this damn angle




The second variant is also with pre-podvypodvert, I just thought of it:

The price can go down or up two candles in a row. Usually, this means feeding adjacent normalised numbers to the inputs.

But, since we are using an offset window, cutting the impulse value at the end will dramatically affect the normalised number, literally in one step a candle with the number 0.7 will turn into -0.3, although the change on the new candle may be zero. This is the problem with windows. And, as I mentioned above, weights have a similar problem, when we input a sequence of numbers, which is also cut off at the end of a new step and one new value is added - nothing may change on the chart, but the weights are different and change the signal dramatically.

Using the example of one normalised number as an input, we can make an additional one - it is the rate of change. After all, the trend may start to fade, prices may gradually start to decrease, and in the input window any increase will be the opposite - showing ever increasing and increasing values.

The additional input will reflect the acceleration - if it is there, it is greater from 0 to 1, if it is fading, it is from 0 to -1.
 
Ivan Butko #:
I haven't tried it yet, but I will definitely try it once I figure out how to find this damn angle

Calculate it as a percentage - from zero to the opening price of the current bar - in essence, it will be an analogue.

 
Aleksey Vyazmikin #:

Count in percentages - from zero to the opening price of the current bar - essentially the analogue will be.

Thank you for the answer, I will think about it
 

The only retraining that works in my memory.

Usually, after a monstrous recovery factor of 68, the balance dives to the bottom on the forward. But here it dropped slightly, then went up for a whole year.

Backtest is messed up (which is at the back, out of optimisation), I have not been able to repeat it on other pairs and periods. So far. So let's write it off to a funny anomaly of EURUSD.

At the same time, the trades are huge, even intraday, and the spread has no effect whatsoever (Zig is clumsy and slow). Eh, a dream


 

I managed to figure out how to feed the angle to the input


I can't say anything about the advantages, the results are different for different terminals. It seems to depend on quotes, spreads and commissions.

But definitely better than price increments.

I would like to note one peculiarity: high values of the angle do not indicate a strong or long trend, but an impulse - an extremely sharp, large and short-term price jump or failure. While a normalised window (another type of input data) even at an extremely sharp angle (almost flat movement) will show high values, if the last price is higher than all the others.

That is, the angle has its informational advantages. Moreover, it is similar to a non-linear function when extreme values are cancelled out. In fact, we will never get a value of 0.95 or 0.99. They say that the angle is almost straight, it is equivalent to the fact that the price has flown into the stratosphere.

In general, there is more food for thought about the angle.


    int i = 0;
    double radians, angle, C1, C5, C20, C80;
    
    C1  = iClose(NULL, PERIOD_CURRENT, 1);  
    C5  = iClose(NULL, PERIOD_CURRENT, 5); 
    C20 = iClose(NULL, PERIOD_CURRENT, 20); 
    C80 = iClose(NULL, PERIOD_CURRENT, 80);   
    
    radians = atan(   ((C1 - C5) / _Point) / 5);   // Вычисляем арктангенс высоты к длине основания в радианах
    angle = radians * 180 / M_PI / 90;             // Конвертируем радианы в градусы и преобразуем в диапазон [-1..1]
    inputs[i] = angle;       i++; 
    
    radians = atan(   ((C1 - C20) / _Point) / 20); 
    angle = radians * 180 / M_PI / 90; 
    inputs[i] = angle;       i++; 
    
    radians = atan(   ((C1 - C80) / _Point) / 80); 
    angle = radians * 180 / M_PI / 90; 
    inputs[i] = angle;       i++;  

    //  Print("Угол: ", angle, " градусов");