You can reference the current chart in most functions by using a chart ID of "0".
For most functions requiring a chart id, the documentation will mention this ...
Parameters
chart_id
[in] Chart ID. 0 denotes the current chart.
However if you want a specific chart id for the current chart, so that you can reference it from a different context, just obtain it with the ChartID() function.

- www.mql5.com
If you show your attempts and describe your problem clearly, you will most probably receive an answer from the community. Use the CODE button (Alt-S) when inserting code.
To learn MQL programming, you can research the many available Articles on the subject, or examples in the Codebase, as well as reference the online Book and Documentation
Where do you find the 'block' where you type in ChartiD() ?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I'm new to mql5 but just wondering how do i get the chart id for my current chart.
I did my research and you have to type this somewhere:
long ChartID();
But where?
Thanks