Download MetaTrader 5
To add comments, please log in or register
Have you installed MetaTrader 5? Find out more about it!
cdp21
36
cdp21 2015.03.27 09:52 

I am running an EA to function as a control panel which is filled with EDIT labels, 20 per currency pair. Another EA works on the symbols I want to trade and read the text description of the EDIT fields it needs and assigns it to variables.

Everything works fine as long as I have it running on 10 symbols. When I increase the number of symbols reaching 20, some EAs "lose" the value read from the EDIT field and turn it to 0. And this happens for different lengths of time. Like when I load the EA everything runs fine, then after 10 minutes it loses all (or only some) of the values it previously read (which were assigned to global variables) for 5 minutes, then it reads them again, then it loses, etc. While at the same time some EAs never lose any value.

I attach a snippet of the code to make things more understandable.

Control Panel (each currency pair has 20 edit fields):

int OnInit()
   {
EditCreate(0,"AUDCADp_OpenHour",0,90,60,40,13,"1","Arial",8,ALIGN_CENTER,false,CORNER_LEFT_UPPER,clrWhite,clrBlack,clrBlack,false,false,false,0);
   
   return(INIT_SUCCEEDED);
   }   

 Then this is the EA running on each pair:

int OpenHour;
string SymbolString=Symbol();

void OnTick 
   {
   OpenHour=StrToInteger(ObjectGetString(ChartFirst(),SymbolString+"_OpenHour",OBJPROP_TEXT));


   LabelCreate(0,"OpenHour",0,10,67,CORNER_LEFT_UPPER,"OpenHour:","Arial",10,clrBlack,0,ANCHOR_LEFT,false,false,false,0);  
   LabelCreate(0,"SymbolOpenHour",0,180,67,CORNER_LEFT_UPPER,IntegerToString(OpenHour),"Menlo",10,clrBlack,0,ANCHOR_CENTER,false,false,false,0);
   }

 Which works perfect as long as there is no more than 20 symbols running with it. When it is more than 20, some EAs lose the value of OpenHour (or other variables) every now and then.

 

I am little clueless on why this happens, so any help is appreciated. Can it be possible that MT4 is overloaded and cannot manage all the operations of the EAs? But that's still strange since the values are assigned to global variables, isn't it? Can the code be "too heavy"?

/
To add comments, please log in or register