internal error?

 

Hi MT4

I have tested OnChartEvent() function with simple code found on help

first operation I have set this:

bool idCreate = ChartSetInteger( 0, CHART_EVENT_OBJECT_CREATE, 1 );
bool idDelete = ChartSetInteger( 0, CHART_EVENT_OBJECT_DELETE, 1 );

then

//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,         // Event identifier  
                  const long& lparam,   // Event parameter of long type
                  const double& dparam, // Event parameter of double type
                  const string& sparam) // Event parameter of string type
  {
Print(TimeToString(__DATETIME__,TIME_DATE|TIME_SECONDS)," - ",__FUNCTION__," - id = ",id );
Print("CHARTEVENT_OBJECT_CREATE = ",CHARTEVENT_OBJECT_CREATE );
Print("CHARTEVENT_OBJECT_DELETE = ",CHARTEVENT_OBJECT_DELETE );

//--- 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");
     }
  }

if I build a new object on chart the function is perfect.....this the debug

2014.02.27 16:35:07.722	Chart_risk_manager EURUSD,H1: The object with name Horizontal Line 23339 has been created
2014.02.27 16:35:07.722	Chart_risk_manager EURUSD,H1: CHARTEVENT_OBJECT_DELETE = 6
2014.02.27 16:35:07.722	Chart_risk_manager EURUSD,H1: CHARTEVENT_OBJECT_CREATE = 7
2014.02.27 16:35:07.722	Chart_risk_manager EURUSD,H1: 2014.02.27 16:35:04 - OnChartEvent - id = 7

if I select and delete object in manual mode on chart there is an event id error....this is debug

2014.02.27 16:36:49.285 Chart_risk_manager EURUSD,H1: CHARTEVENT_OBJECT_DELETE = 6
2014.02.27 16:36:49.285 Chart_risk_manager EURUSD,H1: CHARTEVENT_OBJECT_CREATE = 7
2014.02.27 16:36:49.285 Chart_risk_manager EURUSD,H1: 2014.02.27 16:35:04 - OnChartEvent - id = 8

thanks

 
Welcome to hell.
Reason: