Questions from Beginners MQL5 MT5 MetaTrader 5 - page 109

 
How to withdraw money you have earned if you have not deposited it.
 
vik1991:
How do you withdraw the money you have earned if you haven't deposited it?
I wonder how you made money in the market without an initial deposit
 

Is it possible to parallelize commands in MQL5? For example, to send the execution of a command to another core. In other words, the program will continue to be executed, and a certain function will run in its own context without interfering (taking up time) with the main program. Thank you.

Документация по MQL5: Основы языка / Функции
Документация по MQL5: Основы языка / Функции
  • www.mql5.com
Основы языка / Функции - Документация по MQL5
 
karlen:

Can you parallelize commands in MQL5? For example, to send the execution of a command to another kernel. In other words, the program will continue to be executed, and a certain function will run in its own context without interfering (taking up time) with the main program. Thank you.

No. Alas, multithreading is not supported by the MQL5 compiler.

Such a task can only be implemented by using a dll.

 

Tried to implement a simple perceptron.

The simplest networks go into a stupor. The problem is in the learning algorithm, but I can't find it.

Can you give me a hint, please?

//+------------------------------------------------------------------+
//|                                                   Perceptron.mqh |
//|                        Copyright 2012, MetaQuotes Software Corp. |
//|                                                           panker |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link      "panker"
//+------------------------------------------------------------------+
//+               Класс однослойного перцепторна                     |
//+------------------------------------------------------------------+
class CSNeuron
  {
public:
   double            out_err[];//Ошибки для входов
   
   double            Out(double &_inp[]);// Основная функция вывода
   void              Education(double err);// Фун-ция обучения
                     CSNeuron();
   bool              Load(string name);
   bool              Save(string name);
   void              Init(int inp_count);//Фун-ция инициализации

private:
   bool              init;        //Синглтон инициализации
   int               arr_size;//Размер массива перцептрона
   double            inp[];   //Входы нейронов
   double            ans[];   //Ответы каждого нейрона
   double            weight[];//Веса нейронов
   double            last_out;//Последний результат
   double            l_err;   //Последняя ошибка
   double            k_study; //Коэффициент обучения
   double            summ_akt;//Коэффициент приведения результата
   long              count_mid;
   struct            ToSave
     {
      bool              init;
      int               arr_size;
      double                    last_out,
                                                l_err,
                                                k_study;
     };

   double            Aktiv(double x);//Функция активации
   double            RND();          //Рандомная машина
   
  };
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
CSNeuron::CSNeuron(void)
  {
   init=false;
   k_study=0.00001;
   count_mid=0;
  };
//+------------------------------------------------------------------+
//|              Фун-ция инициализации                               |
//+------------------------------------------------------------------+
void CSNeuron::Init(int inp_count)
  {
   init=true;
   max_akt=inp_count;
   min_akt=-1*inp_count;
   ArrayResize(inp,inp_count,0);
   ArrayResize(weight,inp_count,0);
   ArrayResize(out_err,inp_count,0);
   ArrayResize(ans,inp_count,0);

   ArrayInitialize(ans,0);
   ArrayInitialize(inp,0);
   ArrayInitialize(out_err,0);
   for(int i=0;i<inp_count;i++)
     {
      weight[i]=RND();
     }
   k_study=1/(double)inp_count;
}
//+------------------------------------------------------------------+
//|                      Рандомная машина                            |
//+------------------------------------------------------------------+
double CSNeuron::RND(void)
  {
   double rnd=(double)rand()/32727;
   if(rnd==1 || rnd==0)RND();
   return(rnd);
  }
//+------------------------------------------------------------------+
//|                    Основная функция вывода                       |
//+------------------------------------------------------------------+
double CSNeuron::Out(double &_inp[])
  {
   arr_size=ArraySize(_inp);
   double l_out=0;
   if(!init)Init(arr_size);

   ArrayCopy(inp,_inp,0,0,arr_size);
   for(int i=0;i<arr_size;i++)
     {
      ans[i]=inp[i]*weight[i];
      double d;
      d=ans[i];
      l_out+=ans[i];
     }
   last_out=l_out;
   l_out=Aktiv(l_out);
   return(l_out);
  }
//+------------------------------------------------------------------+
//|                    Функция активации                             |
//+------------------------------------------------------------------+
double CSNeuron::Aktiv(double x)
  {
   
   double y=0;double mid_plus_akt,mid_min_akt;
   summ_akt+=MathAbs(x);count_mid++;
   mid_plus_akt=summ_max_akt/(double)count_mid;
   mid_min_akt=-1*mid__plus_akt;
   
   if(mid_min_akt-mid_min_akt==0)mid_min_akt=0.0001;
   y=((x-mid_min_akt)*1.98)/(mid_plus_akt-mid_min_akt)-0.99;
   return(y);
  }
//+------------------------------------------------------------------+
//|                     Фун-ция обучения                             |
//+------------------------------------------------------------------+
void CSNeuron::Education(double err)
  {
   /*if(k_study<=10 && k_study>=0.00000001)
     {
      double x=k_study/0.1;
      double y=k_study*0.1;
      if(x>=10)if(MathAbs(l_err)<MathAbs(err))k_study*=0.1;
      if(y<=0.00000001)if(MathAbs(l_err)>=MathAbs(err))k_study/=0.1;
      if(MathAbs(l_err)<MathAbs(err))k_study/=0.1;
      if(MathAbs(l_err)>MathAbs(err))k_study*=0.1;
     }
   l_err=err;*/
   
   for(int i=0;i<arr_size;i++)
     {
      out_err[i]=err*weight[i];
      weight[i]=weight[i]+err*k_study*weight[i]*inp[i];
     }
  };
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
bool CSNeuron::Save(string name)
  {
   string name_str=name+"_str";
   string name_arr1=name+"_ans";
   string name_arr2=name+"_weight";
   int handle1=FileOpen(name_str,FILE_WRITE|FILE_BIN);
   int handle2=FileOpen(name_arr1,FILE_WRITE|FILE_BIN);
   int handle3=FileOpen(name_arr2,FILE_WRITE|FILE_BIN);
   if(handle1==INVALID_HANDLE)
     {
      int x=0;while(x<1)
        {
         Print("Can not save file ",name_str);Sleep(10000);
        }
     }
   if(handle2==INVALID_HANDLE)
     {
      int x=0;while(x<1)
        {
         Print("Can not save file ",name_arr1);Sleep(10000);
        }
     }
   if(handle3==INVALID_HANDLE)
     {
      int x=0;while(x<1)
        {
         Print("Can not save file ",name_arr2);Sleep(10000);
        }
     }
   
   ToSave s_data;
   s_data.arr_size=arr_size;
   s_data.init=init;
   s_data.k_study=k_study;
   s_data.l_err=l_err;
   s_data.last_out=last_out;
   if(FileWriteStruct(handle1,s_data,-1)<=0){
      Print("Something is wrong! Dont save s_data!");return(false);
      }
   if(FileWriteArray(handle2,ans,0,WHOLE_ARRAY)<=0){
      Print("Something is wrong! Dont save ans!");return(false);
      }
   if(FileWriteArray(handle3,weight,0,WHOLE_ARRAY)<=0){
      Print("Something is wrong! Dont save weight!");return(false);
      }
   FileClose(handle1);
   FileClose(handle2);
   FileClose(handle3);
   //Print(name," files was succesfully saved");
   return(true);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
bool CSNeuron::Load(string name)
  {
   string name_str=name+"_str";
   string name_arr1=name+"_ans";
   string name_arr2=name+"_weight";
   
   int handle1=FileOpen(name_str,FILE_READ|FILE_BIN);
   int handle2=FileOpen(name_arr1,FILE_READ|FILE_BIN);
   int handle3=FileOpen(name_arr2,FILE_READ|FILE_BIN);
   
   if(handle1==INVALID_HANDLE||handle2==INVALID_HANDLE||handle3==INVALID_HANDLE)
     {
      int x=0;while(x<1)
        {
         Print("Can not load file ",name);return(false);
        }
     }

   ToSave l_data;

   if(FileReadStruct(handle1,l_data,-1)<=0)Print("Something is wrong! Dont load Data!");
   if(FileReadArray(handle2,ans,0,WHOLE_ARRAY)<=0)Print("Something is wrong! Dont load Data!");
   if(FileReadArray(handle3,weight,0,WHOLE_ARRAY)<=0)Print("Something is wrong! Dont load Data!");

   arr_size=l_data.arr_size;
   init=l_data.init;
   k_study=l_data.k_study;
   l_err=l_data.l_err;
   last_out=l_data.last_out;
   Init(arr_size);
   
   FileClose(handle1);
   FileClose(handle2);
   FileClose(handle3);
   //Print(name," files was succesfully load");
   return(true);
  }
 
felidae: I am using my processor resources to do the calculations.
I wonder how it is that you have made money in the market without an initial deposit
 
Why is it that when I have services running the processor is not loaded at all 0% load passes go but slowly in two days of work have earned only 0.01
 

Please tell me please, I have registered and activated a signal on MT4 for some reason it does not work! but on MT4 in the section magazine leaves the following inscription "('3054391': Signal - connect to 78.140.156.176:443 through proxy failed)" what can it be?

 
Reason: