Errors, bugs, questions - page 670

 

Is there any plan to redesign the Gann Grid? It is absolutely impossible to use it: neither manually, nor by extremums, like in MT4, can I stretch or fix it properly - when switching from TF to TF, the size of cells changes, there is no fixed binding! Or maybe I do not understand something...

M1M5

 

Only metals on Alpari do not display bars and OHLC, all others are fine. Quotes go, orders are placed. I moved the terminal to a new folder, does not help. Where can the error be ? W7 64

 
BoraBo:

Only metals on Alpari do not display bars and OHLC, all others are fine. Quotes go, orders are placed. I moved the terminal to a new folder, does not help. Where can the error be ? W7 64

I have the same problem. I have felt that something has gone wrong on the server. Contact Alpari technical support.

 
void OnStart()
  {
//---
symbol2csv(Symbol(),Period());
  }
//+------------------------------------------------------------------+
int symbol2csv(string smb,ENUM_TIMEFRAMES tf)
  {
   ResetLastError();
   int filehandle=FileOpen(smb+"_"+tf2str(tf)+".csv",FILE_WRITE|FILE_CSV,",");
   if(filehandle!=INVALID_HANDLE)
     {
      MqlRates rates[];
      int i=0,copyed=CopyRates(smb,tf,From,To,rates);
      ArraySetAsSeries(rates,false);
      FileWrite(filehandle,"\"Date\" \"Time\" \"Open\" \"High\" \"Low\" \"Close\" \"Volume\""); // writing header
      for(i=0;i<copyed;i++)
        {
         FileWrite(filehandle,TimeToString(rates[i].time,TIME_DATE),TimeToString(rates[i].time,TIME_MINUTES),DoubleToString(rates[i].open,_Digits),DoubleToString(rates[i].high,_Digits),DoubleToString(rates[i].low,_Digits),DoubleToString(rates[i].close,_Digits),rates[i].real_volume);
        }
      FileClose(filehandle);
      Print(smb+" exported "+IntegerToString(copyed));
      return copyed;
     }
   else Print("FileOpen failure. Error is ",GetLastError());
   return -1;
  }
Why does the Volume column in the file always contain 0? And how do I record the volume?
 
Graff:
Why does the Volume column in the file always contain 0? And how to make volume be written?

real_volume for forex instruments?

maybe just try tick_volume for starters

 

What's the error I can't understand?

Here is the code, reduced to a minimum:

//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_plots   1

//---------- MQL5 --------------
int ecx = 0;//-- Кол-во тестируемых пар --
string g_s_SymbolsTrade[] = {"AUDCAD","AUDCHF","AUDJPY","AUDNZD","AUDUSD","CADCHF","CHFJPY","EURAUD","EURCAD","EURCHF","EURGBP","EURJPY","EURNZD","EURUSD",
"GBPCHF","GBPJPY","GBPUSD","NZDUSD","USDCAD","USDCHF","USDJPY"};

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{
   //-- Сколько всего валютных пар --
   ecx = ArraySize(g_s_SymbolsTrade);
   //-- Установить таймер на каждую секунду --
   if (EventSetTimer(1) == false) return(-1);//int 08
   
   return(0);//ret;
}
//----------------------------------------------------------------------------//
void OnDeinit(const int reason)
{
   EventKillTimer();//timer off
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
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[])
{
    
//--- return value of prev_calculated for next call
   return(rates_total);//ret;
}

//+------------------------------------------------------------------+
////////////////////////////////////////////////////////////////////////////////
//                           Expert Timer function                            //
////////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------------------------------
void OnTimer()//int 08
{
static bool b_Flag = false;
string db_SymbolName;
MqlRates rates[];
int edx;

   if (b_Flag == true) return;//ret -- реентерабельность --
   b_Flag = true;//cli
   //---------------------------------------------
   for (int ebx = 0; ebx < ecx; ebx++){
      db_SymbolName = g_s_SymbolsTrade[ebx];
      edx=CopyRates(db_SymbolName,_Period,0,1,rates);
      if (edx != 1){//cmp edx,1 | jne
         b_Flag = false;//sti
         return;//jne ret;
      }   
   }//loop ecx       
   Print ("Загрузка завершена.");
   //---------------------------------------------
   b_Flag = false;//sti
}

When I run it, sometimes immediately or after switching a period of charts suddenly terminal starts to slow down and the entire log is clogged with this:


What is the reason, is it my mistake or an error in the function CopyRates ?

 
pusheax:

What's the reason, is it my fault or an error in the CopyRates function?

Both of them.

Try it this way:

void OnTimer()//int 08
{
static bool b_Flag = false;
if (b_Flag == true) return;//ret -- реентерабельность --
string db_SymbolName;
MqlRates rates[ ecx];    // поправка здесь.
int edx;


   b_Flag = true;//cli
   //---------------------------------------------
   for (int ebx = 0; ebx < ecx; ebx++){
      db_SymbolName = g_s_SymbolsTrade[ebx];
      edx=CopyRates(db_SymbolName,_Period,0,1,rates);
      if (edx != 1){//cmp edx,1 | jne
         b_Flag = false;//sti
         return;//jne ret;
      }   
   }//loop ecx       
   Print ("Загрузка завершена.");
   //---------------------------------------------
   b_Flag = false;//sti
}
 
MetaDriver:

Both of them.

Try it like this:


No, unfortunately, it didn't help.

I wrote it in the following way: MqlRates rates[100];

otherwise: MqlRates rates[ecx]; - gives out a compilation error.

I also liked the idea of moving it to the top:

if (b_Flag == true) return;//ret -- reentrancy --

but unfortunately the result is the same.

Any other ideas?

Документация по MQL5: Стандартные константы, перечисления и структуры / Структуры данных / Структура исторических данных
Документация по MQL5: Стандартные константы, перечисления и структуры / Структуры данных / Структура исторических данных
  • www.mql5.com
Стандартные константы, перечисления и структуры / Структуры данных / Структура исторических данных - Документация по MQL5
 
papaklass:

If the number of bars in the terminal in the chart settings is unlimited. Reduce the number of bars.

It only seems to have one bar copied.
 
papaklass:

So on 25 instruments. I had the same thing on 12 until I reduced the number of bars.

Then it means to servicedesk. The terminal should not exhume all the history from disk symbol by symbol when reading 1 bar.

Even if it's set to unlimited. Caching should be done in a smart way.

--

Good advice in general. I've been thinking - he says "when switching periods". So the terminal stores everything in minutes, it starts calculating the missing periods, and gets stuck with insufficient memory for buffers.

In short - both are to blame. Push has not bought memory, and wants lots and lots of currency pairs at no limit (or about no limit).

And MQ - not treating it as an indicator error (like "Error XXXX : close your lip, comrade"), but only its own.