Errors, bugs, questions - page 3137

 
Hello!
When testing the EA on history for all selected instruments, the tester only gives results for currency pairs, but for crypto it gives "oninit returns non-zero code 1". What can I do about it? Who has experienced this?
 
lapundra1 #:
Hello!
When testing the EA on history for all selected instruments, the tester only gives results for currency pairs, but for crypto it gives "oninit returns non-zero code 1". What can I do about it? Who had it?

Comment out line 123 and the error will go away. I'm telling you as a telepath :) - because there is no code, so only telepathy, no other way :)

 

Greetings.

When running MT5 in the terminal an error occurs:

2022.01.03 15:33:30.108 Virtual Hosting failed to get list of virtual hosts [1001] (tls - create certificate chain engine failed)

2022.01.03 15:34:30.945 Signal '56334871': failed to get list of signals


And next, when trying to connect to a repository in MetaEditor:

2022.01.03 15:34:39.668 Storage projects list request failed with error 1001

2022.01.03 15:34:46.561 Storage activation of MQL5 Storage failed [1001]


At the same time, the connection to another computer worked fine, and all the changes were sent to the Storage.

No network problems were detected on the computer, everything works fine. No "risky" activities have been performed on the computer the last few months either, and everything is working fine. The build is 3140.

Which direction should I dig?


 

I don't even want to look into the mysteries of the Court of Madrid and God forbid me to wonder why indicator handles start indexing from 10 and not from 0 or 1. I don't mind it, I can live with it.

Why should I ask, if there are two kind of independent handles of the same indicator and I delete the second one, not only the second MA, but also the first one disappears? That is, removing one of the handles kills the other as well. Here is the highly simplified and doubled-upiMA code from the Help:

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots   2

#property indicator_label1  "iMA1"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrRed
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1

#property indicator_label2  "iMA2"
#property indicator_type2   DRAW_LINE
#property indicator_color2  clrBlue
#property indicator_style2  STYLE_SOLID
#property indicator_width2  1

double iMABuffer1[], iMABuffer2[];
int    handle1, handle2;
int    bars_calculated=0;

int OnInit()
  {
   SetIndexBuffer(0,iMABuffer1,INDICATOR_DATA);
   SetIndexBuffer(1,iMABuffer2,INDICATOR_DATA);

   PlotIndexSetInteger(0,PLOT_SHIFT,0);
   PlotIndexSetInteger(1,PLOT_SHIFT,0);

   handle1=iMA(_Symbol,PERIOD_CURRENT,10,0,MODE_SMA,PRICE_CLOSE);
   handle2=iMA(_Symbol,PERIOD_CURRENT,20,0,MODE_SMA,PRICE_CLOSE);

   return(INIT_SUCCEEDED);
  }

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   int values_to_copy;

   int calculated=BarsCalculated(handle1);
   if(calculated<=0) return(0);

   if(prev_calculated==0 || calculated!=bars_calculated || rates_total>prev_calculated+1)
      if(calculated>rates_total) values_to_copy=rates_total;
      else                       values_to_copy=calculated;
   else
      values_to_copy=(rates_total-prev_calculated)+1;

   if(!FillArrayFromBuffer(iMABuffer1,0,handle1,values_to_copy)) return(0);
   if(!FillArrayFromBuffer(iMABuffer2,0,handle2,values_to_copy)) return(0);

   //if(handle2!=INVALID_HANDLE)
   //   Print(IndicatorRelease(handle2));

   bars_calculated=calculated;

   return(rates_total);
  }

bool FillArrayFromBuffer(double &values[],
                         int shift,
                         int ind_handle,
                         int amount
                         )
  {
   if(CopyBuffer(ind_handle,0,-shift,amount,values)<0)
      return(false);

   return(true);
  }

void OnDeinit(const int reason)
  {
   if(handle1!=INVALID_HANDLE)
      IndicatorRelease(handle1);
   if(handle2!=INVALID_HANDLE)
      IndicatorRelease(handle2);
  }

If you uncomment the two lines, the result is that nothing is rendered. Expected: the first MA (red) remains.

...And all I wanted to do was clean up the memory.

 
x572intraday #:

I don't even want to look into the mysteries of the Court of Madrid and God forbid me to wonder why indicator handles start indexing from 10 and not from 0 or 1. I don't mind it, I can live with it.

Why should I ask, if there are two kind of independent handles of the same indicator and I delete the second one, not only the second MA, but also the first one disappears? That is, removing one of the handles kills the other as well. Here is the highly simplified and doubled-upiMA code from the Help:

If you uncomment the two lines, the result is that nothing is rendered. Expected: the first MA (red) remains.

...And all I wanted to do was to clean up the memory.

At least:

if(handle2!=INVALID_HANDLE && !FillArrayFromBuffer(iMABuffer2,0,handle2,values_to_copy)) return(0);
 
JRandomTrader #:

At the very least:

Have you checked? It didn't work for me. And you just need to delete one (with memory freeing) and visually leave the other. And from your logic follows: if second handle exists and second buffer wasn't filled, then exit, and it doesn't even come to my line with IndicatorRelease(handle2) (if I've inserted code in the right place).

 
   int dim=5;
   int Arr1[5];// OK
   int Arr2[dim];// '[' - invalid index value

Either I'm totally fucked up or, if not a bug, poke a swat at Help.

 
x572intraday #:

Either I'm completely fucked up, or if not a bug, poke me in the Help.

The size of a static array is a constant, not an int.

 
Valeriy Yastremskiy #:

The dimensionality of a static array is a constant, not an int.

It is possible to define a vector this way, but they are only double.

int n = 5;
vector v(n);
v[0] = 1.2;
 
Aleksey Nikolayev #:

You can define a vector that way, but they only dabble.

Okay. I'd better resize it then.