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

 

Final version of functions of mql5 Expert Advisor with python program.

There are two functions in the advisor, one updates the time in the file and the second reads the actual trading signal in the file, which is formed in the python program.

void OnTick()
  {
   if(!isNewBar())
      return;
   file_refresh_time();
   sig =StringToDouble(file_read_signal());
}

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
string  file_refresh_time()
  {
   string time  = TimeToString(TimeCurrent());
   bool read =false;
   string file_buff[];
   ArrayResize(file_buff,1);
   file_buff[0] = time;
   ArrayResize(file_buff,2);
   file_buff[1] = "not_actual";
   ArrayResize(file_buff,3);
   file_buff[2] = DoubleToString(sig);

   while(1)
     {
      int h=FileOpen("test.txt",FILE_WRITE|FILE_ANSI|FILE_TXT|FILE_COMMON);
      if(h==INVALID_HANDLE)
        {
         continue;
        }
      if(h!=INVALID_HANDLE)
        {
         for(int i=0; i<ArraySize(file_buff); i++)
            FileWrite(h,file_buff[i]);

         FileClose(h);

         break;
        }

     }
   return("0");
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
string  file_read_signal()
  {
   string sg="0.5";
   bool read =false;
   while(1)
     {
      if(read==false)
        {
         string time  = TimeToString(TimeCurrent());
         int h=FileOpen("test.txt",FILE_READ|FILE_ANSI|FILE_TXT|FILE_COMMON);
         if(h==INVALID_HANDLE)
           {
            continue;
           }
         if(h!=INVALID_HANDLE)
           {
            int cnt=0;
            while(!FileIsEnding(h))
              {
               string str=FileReadString(h);
               StringTrimLeft(str);
               StringTrimRight(str);
               if(cnt == 1 && str == "actual")
                 {
                  read =true;
                 }

               if(read ==true && cnt == 2)
                 {
                  sg =str;
                 }
               cnt++;
              }
            FileClose(h);
            if(read ==true)
              {
               FileClose(h);
               break;
              }
           }

        }

     }
   return(sg);
  }

The python program in the "not_actual" status reads the current time, calculates the actual signal and writes it into the file.

terminal_dir = "C:/Users/AdmNB0225/AppData/Roaming/MetaQuotes/Terminal/Common/Files/"
a=0
old_rez = 0
rez = []
while True:

    try:
        with open(terminal_dir+'test.txt', 'r') as file:
            rez = [row.strip() for row in file]
    except IOError:
        pass

    if rez != old_rez and len(rez)!=0:
        print(rez)
        if rez[1] == "not_actual":
            rez[1] = "actual"
            date = rez[0]
            date = datetime.strptime(date, '%Y.%m.%d %H:%M')
            rez[2] = get_signal(date)


            try:
                with open(terminal_dir + 'test.txt', 'w') as file:
                    file.writelines(str(i)+'\n' for i in rez)
            except IOError:
                pass

    old_rez = rez
    # time.sleep(2)

This glue is not very fast, but it works independently. It works in the tester, on the demo, I have not tried it on the real. If there are, questions or ideas how it is possible to improve, write, and the theme as stalled...

 
welimorn:

Final version of functions of mql5 Expert Advisor with python program.

There are two functions in the advisor, one updates the time in the file and the second reads the actual trading signal in the file, which is formed in the python program.

The python program in the "not_actual" status reads the current time, calculates the actual signal and writes it into the file.

This glue is not very fast, but it works independently. It works in the tester, on the demo, I have not tried it on the real. If you have, questions or ideas how you can improve, write, and then the theme is stalled...

I got stuck with laptop speed, when I switched to more complicated recurrence type models. Can't research anything else that's sensible.

i have a new one with a good videoadapter ) must get it for New Year

 
Maxim Dmitrievsky:

I got bogged down with laptop speed when I switched to more complicated recurrence-type models. I can't research anything else that makes sense.

got a new one with a good videoadapter ) need to get me one for the new year

Why the laptop? Tasks are heavy.

 
Valeriy Yastremskiy:

Why the laptop? Tasks are heavy.

Because you can't put a desktop on your stomach in the evening, on the couch.

It's not that heavy, but an ultrabook with two mobile cores is not good.

In fact, the video card is not even needed, just a good CPU

 
Maxim Dmitrievsky:

because you can't put a desktop on your stomach in the evening, on the couch.

It's not that heavy, but an ultrabook with two mobile cores is not good.

in fact, you don't even need a video card, just a good CPU

Translate the image to the tablet from a normal computer, a mouse radio from a computer + keyboard

 
Maxim Dmitrievsky:

because you can't put a desktop on your stomach in the evening, on the couch.

It's not that heavy, but an ultrabook with two mobile cores is not good.

In fact, you don't even need a video card, just a good CPU

Well belly and task heavy)))) For these tasks and a farm would not hurt)))) A 5 i9 with 32gb RAM and a light ssdc)))))

 

What is the use of these powers if you train the hell with the hell with the hell with the hell with the hell with the data and the hell with the target...

The result is obvious, even if there are 100 i9s.

Aleksey Vyazmikin:

Boosts also use a gradient. This is just information to expand knowledge and methods suitable for MO.

So, what happened? Did you do something or just threw the video and forgot?

 
mytarmailS:

Okay, so what? Did you do something? Or just threw the video and forgot?

No I didn't, I can't solve such a problem - it's a complicated algorithm, and I have to write my own boosting.

 
Aleksey Vyazmikin:

No, I didn't, I can't solve such a problem - it's a complicated algorithm, and I have to write my own boosting.

everything has already been written a long time ago, in 5 lines you can do....

Get rid of it without mql, all it can do is open/close trades

 
Maxim Dmitrievsky:

I got bogged down with laptop speed when I switched to more complicated recurrence-type models. I can't research anything else that makes sense.

Picked a new one with a good videoadapter ) I'll have to give it to myself for the new year

I have the same problem. I have to store all graphical interpretations of kotir in 50x50 pixels images)) making a smaller image makes no sense, it greatly reduces accuracy. A larger image will increase the width of the convolution layer, and the depth of the network in general, which will greatly increase the learning curve. Here too, I'm saving up for a new machine... At the same time I am trying to curb the learning on GPU.

Reason: