Errors, bugs, questions - page 351

 
Same error inCHistoryOrderInfo::FormatOrder, CDealInfo::FormatDeal
 
Mr.FreeMan:

Why is the expert unloaded when the button is pressed?

What does it say in the log?
 
sergey1294:
What do you read in the log?


2011.04.03 19:19:31 simple (EURUSD,M15) Array out of range in ' simple.mq5' (43,19)

This isnot the right code, here is a code of the Expert Advisor that is unloaded on pressing the button:

int ZigZag1Handle,ZigZag2Handle,ZigZag3Handle;
double ZigZag1[],ZigZag2[],ZigZag3[];
string row;
int bar;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   if(ObjectFind(0,"history")<0)
     {
      ObjectCreate(0,"history",OBJ_BUTTON,0,100,100);
      ObjectSetInteger(0,"history",OBJPROP_XDISTANCE,220); 
      ObjectSetInteger(0,"history",OBJPROP_YDISTANCE,5);
      ObjectSetInteger(0,"history",OBJPROP_CORNER,CORNER_LEFT_UPPER); 
      ObjectSetString(0,"history",OBJPROP_TEXT,"Передать историю");   
      ObjectSetInteger(0,"history",OBJPROP_FONTSIZE,8);
      ObjectSetInteger(0,"history",OBJPROP_XSIZE,110); 
      ObjectSetInteger(0,"history",OBJPROP_YSIZE,20);
      ObjectSetInteger(0,"history",OBJPROP_SELECTABLE,false);
      ChartRedraw(0);
     }
   ZigZag1Handle=iCustom(NULL,0,"Examples\\ZigZag",6,2,3);
   return(0);
  }
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
   if(id==CHARTEVENT_OBJECT_CLICK)
     {
      string Text="history";
      if(sparam==Text)
        {

         ArraySetAsSeries(ZigZag1,true);
         if(CopyBuffer(ZigZag1Handle,0,0,90,ZigZag1)<0){Comment("ZigZag1 error =",GetLastError());}

               if(ZigZag1[bar-1]>ZigZag1[bar-2])
                 {

                 }
        }
      ObjectSetInteger(0,"history",OBJPROP_STATE,false);

     }
  }
//+------------------------------------------------------------------+
 
Mr.FreeMan:


2011.04.03 19:19:31 simple (EURUSD,M15) Array out of range in ' simple.mq5' (43,19)

Wrong code, here is the code of Expert Advisor that is unloaded on pressing the button:

It is clearly written in the log why. If translated into Russian, it says the following - exit outside the array in simple.mq5. The error at line 43

And there is one more thing. Most likely, the error is that you haven't set the array size

double ZigZag1[],ZigZag2[],ZigZag3[];
Документация по MQL5: Операции с массивами / ArrayResize
Документация по MQL5: Операции с массивами / ArrayResize
  • www.mql5.com
Операции с массивами / ArrayResize - Документация по MQL5
 
sergey1294:
It is clearly written in the log why. If translated into Russian, it says the following - exit outside the array in the simple.mq5 file.
aah)) shit) understood my stupidity) thanks.
 
Please respond. Limiting the indicator cache.
 
Gentlemen! Can you tell me if there is a class that can be sent an array of table elements, and it will display this table on the chart?
 
Graff:
Gentlemen! Can you tell me if there is a class that can be sent an array of table elements and it will display this table on a chart?
And for what purpose?, specify the conditions.
 
There is a multidimensional array, it just needs to be plotted as a table. is there a standard class for quick table output?
Документация по MQL5: Основы языка / Переменные
Документация по MQL5: Основы языка / Переменные
  • www.mql5.com
Основы языка / Переменные - Документация по MQL5
 
Graff:
There's a multidimensional array, it just needs to be plotted as a table. maybe there's a standard class for quick table output?

Print it to a file and look it up in excel.

But I think you won't be satisfied with this, so I asked for additional conditions like "this should be displayed on the fly", etc.