What is a current chart?

 
Which one of these is a current hart
1. The chart upon which the EA is attached.
2. The chart that is last clicked on the window.

A little confused here. Any help?
 
The chart the code is running on. You are confusing current with foreground.
 
William Roeder:
The chart the code is running on. You are confusing current with foreground.

Thanks a lot
 
William Roeder #:
The chart the code is running on. You are confusing current with foreground.

If that is the case then,

ObjectCreate(0,"MyObjName",OBJ_BUTTON,0,0,0);

creates the object on the current chart since chart id is 0.

If

ChartID()

returns the id of the current chart, then it means it is the same as 0. But It does not print zero when used below: I don't get the reason for that.

long chartID = ChartID();
while (chartID >= 0)
  {
   Print (chartID);
   chartID = ChartNext(chartID);
  }
 
macpee #: If that is the case then,

Don't double post! You already had another thread open.

          General rules and best pratices of the Forum. - General - MQL5 programming forum (2017)
 
macpee #:

If that is the case then,

creates the object on the current chart since chart id is 0.

If

returns the id of the current chart, then it means it is the same as 0. But It does not print zero when used below: I don't get the reason for that.

0 is not the Chart ID, but it can be used to refer to the current chart that the program is running on when calling a built-in function that require a Chart ID parameter.

Reason: