Question about Chart Events

 

Hi,

can somebody tell me why this indicator isn't working?

int OnInit()
  {
//--- indicator buffers mapping
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| 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);
  }
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
//---

   if (id == CHARTEVENT_OBJECT_CREATE) {
      Alert(sparam, " created");
   }
   else if (id == CHARTEVENT_OBJECT_CHANGE) {
      Alert(sparam, " changed");
   }
   else if (id == CHARTEVENT_OBJECT_DELETE) {
      Alert(sparam, " deleted");
   }
  }
//+------------------------------------------------------------------+
 
Firing of some events must be explicitly enabled.
 
Ovo: Firing of some events must be explicitly enabled.
As the documentation says Event Handling Functions - MQL4 Documentation
 
Can you please precise that a bit? I read this documentation but I have no idea what is missing. I use OnChartEvent and I check the id if an object is created or deleted. What is wrong/missing here?
 
Found something useful on the MQL5 website.