Machine learning in trading: theory, models, practice and algo-trading - page 1851

 
Mihail Marchukajtes:

Alexei, thank you very much. I will definitely check everything and report the results. As for looking into the future, it is absolutely unimportant and it will not happen if the EA will write the way the indicator will read. If there is no difference between them, it does not matter. Alternatively, when a new bar appears, we wait for the first change of OI and write this new value for the first previous bar. We can even write not a new value, but the old value, which was the last for the first bar. That is, in fact, the entry will be made at the close of the bar.

It is not important which OM we assign to the minute bar, but how the indicator will be read from the file.

Also, think not only about learning, but about using the model when the data will be taken from the market - what will be the most reliable data. Now the data will be saved at the opening of the candle, that is, on the zero bar there will be no change after the opening (if I've got it right :) ). If you need data on a close bar, you may modify it in any case. The only difference is the value of the bar from which the data are obtained - from the last bar or from the last but one.

 

neocognitron - a kind of convolutional network but without a teacher

https://habr.com/ru/post/214317/

Who understands how it works, please explain it to me

 
Aleksey Vyazmikin:

Also think not only about learning, but also about applying the model when the data will be taken from the market - that there would be the most reliable data. The data will be saved at the opening of the candle, i.e. on the zero bar there will be no change after the opening (if I've got it right :) ). If you need it on a close bar, you can do this later. The only difference is the last or the penultimate bar from which to get data from the EA.

Look, even though the EA starts to work at the opening bar, it still takes data from the first bar. In my case, rather, even the second bar, well, this is my quirk because we do not need to wait those 30 seconds for updates on the first bar, the second exactly has already been calculated and for quite a long time. That is why writing the first OI value in the open bar is not so scary. It turns out that the current value is written in the history. There is no need to look into it. And it does not matter, we are not copying it. The main thing is that the indicator reads it correctly. You have an additional function in your indicator for reading a file with the condition "True Date". For correct loading of history from the file I had to add the following line

 if(New_Data==true)
            {
               ArrayResize(oi,x+2,1000);
               if(cnt==0)
               {
               Arh_Time=StringToTime(str);///////////// Если честно в обще не понял зачем ты так это всё разделил
                  oi[x].time=Arh_Time;                 //если запись первая, т.е. дата, то конвертируем из стринга в дататайм
               }

               else if(cnt==1)
               {
                  oi[x].oi=Arh_oi;   //если запсиь вторая, т.е. ОИ, то конвертируем в инт и
                  New_Data=false;
                  x++;
               }
            }

And the indicator started working with the data recorded per minute and by tick, all in one file. I even checked how different timeframes are built and everything worked fine, but I had to change this line in the main body as well

for(int s=f; s<count_size; s++)
            {
               //Print("Test_02");
               if(oi[s].time>time[i])
               {
                  //Print("Test_03");
                  if (s>1)BufOI[i-1]=oi[s-1].oi; /// иначе всё бралось с минутой позже
                  //Print("s=",s);
                  f=s;
                  break;
               }
               if(s+1==count_size)
               {
                  BufOI[i]=SymbolInfoDouble(Symbol(),SYMBOL_SESSION_INTEREST);
                  //Print("OI=",SymbolInfoDouble(Symbol(),SYMBOL_SESSION_INTEREST));
                  if(BufOI[i]<1)BufOI[i]=BufOI[i-1];
                  if(BufOI[i]<1 && BufOI[i-1]<1)BufOI[i]=100;
                  f=s;
               }
            }

I placed the EA on the chart and am waiting for the opening, I will look at the minutiae as it is written and the indicator does not change the data during recompilation.

Here is an indicator and do not thank me :-)!!!! Just kidding with thank you so much. How about 37 bucks? Want to earn?

Files:
OI_Test.mq5  16 kb
 
Aleksey Vyazmikin:

If the Expert Advisor works by the bar opening, even if it is delayed, is it correct to feed it with the data by the candle closing, i.e. to look into the future? That's why the most recent data before this candle is taken, i.e. a small delay, but not advance.


Where is the calculation of 5 ticks? It happens that within a minute there is no trade, then you miss a bar, that's why I removed the comparison for the change of the volume of OM, that the data were written immediately at the opening of a new candle. Maybe I didn't take it into account, I needed to test it on data, and yesterday it was out, and today it's weekdays :(

Yes there will be a gap and I should rewrite its value from the second bar. But my question remains unanswered: will the condition for a new bar be fulfilled when the ball opens and a few ticks pass, as an example, and only then will the OM change?
 
The sad thing is that the first or second bar does not write in the normal time mode. When recompiling the indicator history is loaded, but only up to the third bar, neither the second nor the first is not updated, although they are in the file in fact.
 
Mihail Marchukajtes:

Look adviser even begins to work at the opening of the bar, he still takes the data from the first. In my case, even from the second bar, well, this is my quirk because I do not need to wait those 30 seconds to update the values on the first bar, the second is already exactly calculated and long enough. That is why writing the first OI value in the open bar is not so scary. It turns out that the current value is written in the history. There is no need to look into it. And it does not matter, we are not copying it. The main thing is that the indicator reads it correctly. You have an additional function in your indicator for reading a file with the condition "True Date". For correct loading of history from the file I had to add the following line

And the indicator started working with the data recorded per minute and by tick, all in one file. I even checked how different timeframes are built and everything worked fine, but I had to change this line in the main body as well

I placed the EA on the chart and am waiting for the opening, I will look at the minutiae as it is written and the indicator does not change the data during recompilation.

Here is an indicator and do not thank me :-)!!!! Just kidding with thank you so much. How about 37 bucks? Do you want to make money?

If you don't use a zero bar, of course you can do a look ahead. I've been doing a custom one here, the way I work with the data.

The only thing that confuses me is.

if (s>1)BufOI[i-1]=oi[s-1].oi; /// иначе всё бралось с минутой позже

This inequality may not be observed. Because the time of the first tick may not coincide with the time of opening of a candle. Save instead of time from file,

Arh_Time=StringToTime(str);

the truncated time to the minute from the variable NewTime.

And about the reward - I thought I already earned it :)


Mihail Marchukajtes:
Yes, there will be a gap and you have to rewrite the value from the second bar. But my question remains unanswered: will the condition for a new bar be fulfilled when the ball opens and a few ticks pass, as an example, and only then will the OI change?

The check for a new bar occurs after the change in volume, so must get to the part of the code where the record occurs.


Mihail Marchukajtes:
Sadly, neither the first nor the second bar is written in rAltime mode. When I recompile the indicator the history is loading but only till the third bar, neither the second nor the first one is updated, though they are in fact in the file.

Doesn't write where? The Expert Advisor does not write? Try the old version of the EA where it wrote several times a minute and see if the indicator will work correctly with it.

 
Aleksey Vyazmikin:

If you don't use the zero bar, of course you can do a look ahead. I've been doing this for myself, the way I work with data.

The only thing that confuses me is.

This inequality may not be respected. Because the time of the first tick may not coincide with the time of opening of a candle. Save instead of time from file,

the truncated time to the minute from the variable NewTime.

And about the reward - I thought I already earned it :)


Checking for a new bar occurs after volume changes, so must get to the part of the code where writing takes place.


Where does it not write? The Expert Advisor does not write? Try the old version of the EA where it wrote several times a minute and see if the indicator will work correctly with it.

I am currently dealing with the advisor, it keeps changing the value of the first bar in the file for some reason. It feels like the new bar is always better. The picture is like this when I recompile.

And so with each recompilation. What is HZ? I've tried many things sometimes it loads it sometimes not...

 
Mihail Marchukajtes:

Now I am dealing with the Expert Advisor, for some reason it constantly changes the value of the first bar in the file. It feels like the new bar is always better. The picture is the same after recompiling.

And so with each recompilation. What is HZ? I've tried lots of things sometimes it loads it sometimes not...

My EA hasn't called your EA at all - I have to try it out. If I wanted to, it would not work, and I don't want it to open or close.

 
Aleksey Vyazmikin:

My EA does not write your EA at all - I need to figure it out. Or send me the working version only for Si, that it would write.

There everywhere you need to specify the current futures contract. Of course, it does not work with splice. I'm going to attach the current version of the indicator that loads only the second bar when compiling, while the first bar always changes, I understand it's where the current OM is written.

Files:
 

Alexey, can we make the indicator to read the readings from the file for the first bar when a new bar appears and thereby the most complete synchronization will be achieved. In fact, it won't stand on the chart, and it will be called periodically from signal to signal... The problem is that the EA is written with the help of Marketbuk and the indicator receives data independently from the exchange. I think we should use market book monitoring and this is what the indicator got. Profit!!!!!

I think the only source of OI should be the EA and the duplication of requests to the exchange is not acceptable, otherwise we just bother to negotiate. What do you think?

Обработчик события "новый бар"
Обработчик события "новый бар"
  • www.mql5.com
Для создателей индикаторов и экспертов всегда был актуален вопрос написания экономичного кода с точки зрения времени выполнения. Можно подойти к решению этой задачи с разных сторон. Из этой обширной темы в данной статье будет затронут, казалось бы уже решенный вопрос: проверка появления нового бара. Это достаточно популярный способ ограничения...
Reason: