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

 
Mihail Marchukajtes:

That's the kind of programmer I am. No one can explain it, until you figure it out... Anyway,people!!!!! Listen up. Here comes the important long post......


it's an evolution of sorts ... make or die called :) i'm exactly the same programmer

 
Mihail Marchukajtes:

Anyway folks!!!!! Listen up. Here comes the important long-post......

Teacher, burn!

 

You all know very well that I have a fondness for Open Interest (OI) because it is a key link in determining the nature of the volume traded. Combined with the delta...mmmmm.... Just a tasty tasting.... The OI of course is not a panacea, but improving the quality of the model even by 10% will already have a high weight!!!! And oh Miracle!!!! I finally got to it in the gut of the day, but unfortunately only MT5 has such features, which was the decisive factor for the transition from MT4 in favor of 5. I`m very thankful to Rafil who helped me to save my time and gave me a good start. The OM is already being written and there is a stat for the week. Of course it's not enough, but it's already possible to start with M5, moreover the spread influence on Si in this timeframe is insignificant comparing to the volatility of the instrument in general. Well... the data is there, it's just a small thing, as I thought. I wanted to train the model and see what the Delta+Volume+OI combination is capable of. I've got a good working knowledge of Мкуль5, but after I found it I think I already reached the finish line and faced a wall of misunderstanding in this wonderful and powerful language. The general concept of TC is this.

The method is based on the intermediate values of the three types of indicators: Delta + AD (in the place of volume I will take it) + OM, where OM is pumped from the file and strange as it is no problem, but there are real problems with AD and I can not understand why.

To prepare a training set, I use the application script below. This script unloads signals of the basic strategy into csv file. Then we build the model and shove it into another indicator. I have two of them. BuySi and SellSi, they are the same indicators that contain AI. For inputs these indicators address a set of indicators Delta+AD+OI. The indicator from the indicator, especially in one package... What could be the problem... But no... There are problems .... and I think that I am the only one, because of my knowledge in such a wonderful and wonderful programming language.... so... where was I... oh yeah.... The problem is this:

The script unloads one data to the file, and during the test at the time of the signal in the printer displays other values. Ie the same signal in the file says one thing, but in fact at the time of testing at the input is completely different. And here is the paradox. The handle initialization and buffers accessing itself were copied from the script. BUT BuySi at the time of the test loads adequate data, because I checked it by hand. And the most interesting thing is that OM loads the same file and the input to the AI, but the AD standard, terminal. In the file some values, in fact other. I think it has to do with this parameter when we try to call the indicator for a different instrument from the one being tested. I think that the problem is in the synchronization of quotes and indices values. I think this solution may require some preliminary preparation. That is why I am asking people for help. Why does the script fetches the same iAD values, but when I test the values are different and consequently the signals start to change? When induks are on the chart, i.e. calculated during the initialization process The picture looks as follows.

I think it is very good. The influence of the OM is felt at once, but when I run it in the tester the picture changes... and not for the better.

And the tester makes two runs with different signals. This is necessary for the indulators to have time to pump up the buffers. Calculating the AI is done with a delay and the error 4806 no longer appears, but the dancing signals and the difference in the data, absolutely identical code with the STANDARD indicator iAD I'm pretty worn out that I was too lazy to write this long post, hoping for help. I think the problem is in the iCustom, when the indicator is called on a different instrument from the current one. Just the same began to drizzle OI, but then I forced him to load from specific files and all passed, but what to do with iAD?

That's how I call in the script, which creates a file with data.

AD_H =iAD("BR-12.17",   0, VOLUME_REAL);  Sleep(1500);

Further, I refer to the buffer so...

  double AD(int index)
  {
   double MA[1];
   ResetLastError();
   if(CopyBuffer(AD_H,0,index,1,MA)<0)
     {
      PrintFormat("Failed to copy data from the iMA indicator, error code %d",GetLastError());
      return(0.0);
     }
   return NormalizeDouble(MA[0],Digits());
  }

And subsequently calculate the input so.

      double AD=(AD(i+1)-AD(i+PNT+1))*Cont;

This is all in a script, but it looks in an indicator with AI, where the handle is written in the following way

AD_H =iAD("BR-12.17",   0, VOLUME_REAL);  

Reference to the buffer is like this...

  double AD(int index)
  {
   double MA[1];
   ResetLastError();
   if(CopyBuffer(AD_H,0,index,1,MA)<0)
     {
      PrintFormat("Failed to copy data from the iMA indicator, error code %d",GetLastError());
      return(0.0);
     }
   return NormalizeDouble(MA[0],Digits());
  }

Input calculation is like this....

      double AD=(AD(i+1)-AD(i+PNT+1))*Cont;

It's understandable, because everything was copied from the clipboard. But why is there such a difference in the final result. I still think that this is because of the call of the indicator with another tool. There is no need to prepare anything, like synchronization or checks before calling the indicator with another symbol. What do you think about it????

 
Vizard_:

Master, fire away!


OOO It's easy to see... a serious crowd has arrived. I think the debate will be hot :-)

 

And now I compiled the inductor and it outputs exactly the data that it writes in the file to the printer. But during the test the same signal on the input has already other values. How is it so?

 

I see there will be no movie???? Sad :-(

 

Just a guess, but -

AD depends on the volume, which means that the value on the zero bar is constantly changing. If you fill the file with the generated AD values in advance, and then read this file and use it for testing, then you may well be looking ahead, using the value of the already generated zero bar at a time when it is not yet known in the Expert Advisor itself.

 
Dr. Trader:

Just a guess, but -

AD depends on the volume, which means that the value on the zero bar is constantly changing. If you fill the file with generated AD values in advance, and then read this file and use it for testing, then you may well be looking into the future, using the value of the already generated zero bar at a time when it is not yet known in the EA itself.


No. No files are written using AD, everything is taken directly from the symbol. I think this is because there is no check for synchronization. And error 4806 was always. I introduced a delay into the main indicator and the error disappeared, but the problem persisted. :-(

 

Here is the print from the terminal after compilation.

2017.11.27 20:59:17.625 Buy_Si (Si-12.17,M5)2017.11.23 11:05:00 1.0 -116.0 64.0 2292.0 -206.0 413 4

And here from the agent.

2017.11.27 20:59:38.318 2017.11.23 11:10:40 2017.11.23 11:05:00 1.0 -116.0 140.0 -1889.0 -993.0 1 4

Notice this is the same signal. the time 11:05:-116 is the OI which is taken from the file, also the same. Then there are three AD values from different characters. Then i bar well and parameter pont.

Why data on AD are different. Synchronization check inserted....?

 

I do not understand anything without the code.

It is necessary to create a simple Expert Advisor with a minimum set of functions to simply read the indicator values and write them into a log file (or better - into csv file for more convenient comparison later). The results of two runs should be different. Then this should be sent to Service Desk together with the Expert Advisor's code.
You can also attach the code there -https://www.mql5.com/ru/forum/1111/page2096 - knowledgeable people will check and confirm or explain what is wrong.

Reason: