OnChartEvent always fires 11 times!!

To add comments, please log in or register
gbulle
47
gbulle  

Hello Everybody,

I trap  trend line create and delete events:

int OnInit()
  {
//--- enable object create events
   ChartSetInteger(ChartID(),CHART_EVENT_OBJECT_CREATE,true);
//--- enable object delete events
   ChartSetInteger(ChartID(),CHART_EVENT_OBJECT_DELETE,true);

}

but when I enter into   OnChartEvent :

void OnChartEvent(const int id,const long &lparam,const double &dparam, const string &sparam)
  {
  if(id==CHARTEVENT_OBJECT_CREATE ){
         Print("CREATE: "+IntegerToString(lparam) +" sparam: "+sparam+ " tot : "+ IntegerToString(ObjectsTotal(OBJ_TREND)));     
   }
   if(id==CHARTEVENT_OBJECT_DELETE ){     

          Print("DELETE: "+IntegerToString(lparam) +" sparam: "+sparam+ " tot : "+ IntegerToString(ObjectsTotal(OBJ_TREND)-1));

  }

  }

the print statements write for 11 times and not only one as supposed.

Why this? Any suggestion?

Thank you very much for your time

GB

Alain Verleyen
39032
Alain Verleyen  

Only 1 time :

2014.05.16 17:19:35.839    CheckObjectEvents (EURUSD,H1)    DELETE: 0 sparam: H1 Trendline 46990 tot : -1
2014.05.16 17:19:27.398    CheckObjectEvents (EURUSD,H1)    CREATE: 0 sparam: H1 Trendline 46990 tot : 0

gbulle
47
gbulle  
angevoyageur:

Only 1 time :

2014.05.16 17:19:35.839    CheckObjectEvents (EURUSD,H1)    DELETE: 0 sparam: H1 Trendline 46990 tot : -1
2014.05.16 17:19:27.398    CheckObjectEvents (EURUSD,H1)    CREATE: 0 sparam: H1 Trendline 46990 tot : 0

Thank you very much.

I will investigate better..


TX

To add comments, please log in or register