OnChartEvent can't catch CHARTEVENT_OBJECT_CREATE

Back to topics list To post a new topic, please log in or register
avatar
43
asuralm 2015.10.11 15:18
 

Hi all:

 

I write a simple code to catch the new created object on the chart.

 

void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
{
   
   Print("id = ",id );
//--- the object has been deleted
   if(id==CHARTEVENT_OBJECT_DELETE)
     {
      Print("The object with name ",sparam," has been deleted");
     }
//--- the object has been created
   if(id==CHARTEVENT_OBJECT_CREATE )
     {
      Print("The object with name ",sparam," has been created");
     }
}

 

But whatever object I create on the chart, the function just can't catch it. Is this the bug of the new release of MT4? 

My MT4 version  is Build 840 (12 Jun 2015)

 Help please.

 

Thanks 

avatar
Moderator
3412
GumRai 2015.10.11 21:53 #
 
   ChartSetInteger(0,CHART_EVENT_OBJECT_CREATE,true);
   ChartSetInteger(0,CHART_EVENT_OBJECT_DELETE,true);
Put these 2 lines in OnInit
Back to topics list  

To add comments, please log in or register