Errors, bugs, questions - page 572

 
Interesting:

Where and how is MarketWatch generated?

as I understood this block is trying to add a symbol to the list, with checking the result.

But if Expert Advisor is a multiple currency pairs (which is not obvious from above example).

This code is in a currency pair loop, Exp_Symbol on every pass, except the first, is a "foreign" currency pair. If there are five currency pairs, SymbolSelect(Exp_Symbol, true) will be called five times for five different symbols.

The call to SymbolSelect(), SymbolIsSynchronized(), CopyRates() functions in my code by "alien" symbols (the history should be updated accordingly). At first test there is data, but at second test there is no data and Expert Advisor crashes in the tester.

 
Konstantin83:

This code is in currency pair loop, Exp_Symbol on every pass except first one is "alien" currency pair. I have a call to SymbolSelect(), SymbolIsSynchronized(), CopyRates() functions by "alien" symbols (hence the history should be swapped). At first test there is data, but at second test there is no data and Expert Advisor crashes in the tester.


Can you send to servicedesk an expert and description of optimization/testing settings?
 
alexvd:
Can you send an expert and a description of the optimisation/testing settings to servicedesk?
Created.
 
Just now, the quotes are hanging up again in the demo account. There is communication but no movement.
Документация по MQL5: Стандартные константы, перечисления и структуры / Состояние окружения / Информация о счете
Документация по MQL5: Стандартные константы, перечисления и структуры / Состояние окружения / Информация о счете
  • www.mql5.com
Стандартные константы, перечисления и структуры / Состояние окружения / Информация о счете - Документация по MQL5
 

I want to unload the data for January 2009. I have unloaded data for 15 minutes and hour, but I can't unload the data for 5 minutes, it says there is no history. Why is not downloading history of 5 minutes?

void OnStart()
  {
   int size = 25;
   datetime dateFrom;
   datetime dateTo;
   MqlRates rates[];
   MqlDateTime stDate;
   int FileHandle;
  
   stDate.day  = 1;
   stDate.hour = 0;
   stDate.mon  = 1;
   stDate.year = 2009;
   dateFrom    = StructToTime( stDate );
   stDate.day  = 31;
   dateTo      = StructToTime( stDate );
  
  
   ArraySetAsSeries(rates,true);
  
   int copied=CopyRates(Symbol(), PERIOD_M5, dateFrom, dateTo, rates);
   for(int i=0;i<100;i++)
     {
      if(GetLastError()!=0)
       {
        Sleep(5000);
        copied=CopyRates(Symbol(), PERIOD_M5, dateFrom, dateTo, rates);
       }
      else
       {
        break;
       }
      Print("Нет истории, проход № " + i);
     }
   if(copied>0)
     {
      Print("Скопировано баров: "+IntegerToString(copied));
      //string format="open = %G, high = %G, low = %G, close = %G, volume = %d";
      string out;
      size = ArraySize(rates);
      ResetLastError();
     
      FileHandle=FileOpen("Data.csv",FILE_WRITE|FILE_CSV);
      if(FileHandle==INVALID_HANDLE)
        {
         Print("Ошибка " + IntegerToString((GetLastError())));
        }
      for(int i=size-1;i>=0;i--)
        {
         FileWrite(FileHandle, TimeToString(rates[i].time), DoubleToString(rates[i].open, _Digits), DoubleToString(rates[i].high, _Digits), DoubleToString(rates[i].low, _Digits), DoubleToString(rates[i].close, _Digits));
        }
     
      Print("size = " + FileSize(FileHandle));
      FileFlush(FileHandle);
      FileClose(FileHandle);
     }
   else
    {
     Print("Не удалось получить исторические данные по символу ",Symbol());
     Print("Ошибка " + GetLastError());
    }
  }

 

I decided to check how ArrayResize function works with all parameters. It compiles without problems, auto-trading is enabled everywhere, but the Expert Advisor unloads from the chart without even going to OnInit.

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   Print(__FUNCTION__);
//---
   return(0);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   Print(__FUNCTION__);
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick() {
   double ZZ[][2];
//==============================================   
   Print(__FUNCTION__);
   
   ResetLastError();
   ArrayResize(ZZ,5,5);
   for(int i=0;i<10;i++) {
      ZZ[i][0]=i;
      Print("i=",i,"; ZZ=",ZZ[i][0]);
      Print(GetLastError());
   }
   return;
}
//+------------------------------------------------------------------+

What is the problem, I can't figure it out.

1

2

 
Talex:

I decided to check how ArrayResize function works with all parameters. It compiles without problems, auto-trading is enabled everywhere, but the Expert Advisor unloads from the chart without even going to OnInit.

What is the problem, I can't figure it out.


Banal out of range, check in "Experts" tab
Reserving is not an allocation, your array is still five items, although the memory is allocated for 10.

 
mql5:

Banal out of range, look at the "Experts" tab.
Reserving is not allocation, your array is still five items, even though you have allocated memory for 10.

Right, thanks. Was looking at the wrong tab, I'm sick, it must be affecting me.
 
Talex:

I decided to check how ArrayResize function works with all parameters. It compiles without problems, auto-trading is enabled everywhere, but the Expert Advisor unloads from the chart without even going to OnInit.

Generally speaking, the screenshot above shows the terminal log. And what you are looking for is in the Experts tab.
 

Hello,

I, after testing and enabling optimisation, get this:

Core 1 genetic pass (127, 1195) tested with error "critical runtime error

The test is normal.

Reason: