Download MetaTrader 5
To add comments, please log in or register
Need mobile version of MetaTrader 5? Download it and trade!
mar
1143
mar 2015.03.23 11:56 

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");
   }
  }
//+------------------------------------------------------------------+
Ovo Cz
2951
Ovo Cz 2015.03.23 12:04  
Firing of some events must be explicitly enabled.
whroeder1
13640
whroeder1 2015.03.23 12:19  
Ovo: Firing of some events must be explicitly enabled.
As the documentation says Event Handling Functions - MQL4 Documentation
mar
1143
mar 2015.03.23 12:29  
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?
mar
1143
mar 2015.03.23 13:51  
Found something useful on the MQL5 website.
/
To add comments, please log in or register