Download MetaTrader 5
To add comments, please log in or register
Download MQL5 library codes via MetaTrader. It is convenient!
Ming Luo
293
Ming Luo 2015.10.11 13: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 

Keith Watford
Moderator
8007
Keith Watford 2015.10.11 19:53  
   ChartSetInteger(0,CHART_EVENT_OBJECT_CREATE,true);
   ChartSetInteger(0,CHART_EVENT_OBJECT_DELETE,true);
Put these 2 lines in OnInit
/
To add comments, please log in or register