Download MetaTrader 5

chart event

To add comments, please log in or register
Mohsen Khashei
648
Mohsen Khashei  

Hi

I wana know that is there a way to get the bar properties of the clicked position on the chart ?

I mean i want to click on a position on chart and for example the date of clicked position returned.

thanks. 

phi nuts
2184
phi nuts  
pumper:

Hi

I wana know that is there a way to get the bar properties of the clicked position on the chart ?

I mean i want to click on a position on chart and for example the date of clicked position returned.

thanks. 

You have to create a CI (or EA) for that. To get the X and Y of chart pixel coordinates, use OnChartEvent with CHARTEVENT_CLICK  (event of a mouse click on the chart). Convert those X and Y pixel coordinates to X and Y time-price coordinates using ChartXYToTimePrice. From there, you get the time and price data, which can be used with any copy function from Timeseries and Indicators Access
Mohsen Khashei
648
Mohsen Khashei  
phi.nuts:
You have to create a CI (or EA) for that. To get the X and Y of chart pixel coordinates, use OnChartEvent with CHARTEVENT_CLICK  (event of a mouse click on the chart). Convert those X and Y pixel coordinates to X and Y time-price coordinates using ChartXYToTimePrice. From there, you get the time and price data, which can be used with any copy function from Timeseries and Indicators Access
thanks for replay just the function i'v looking for
Mohsen Khashei
648
Mohsen Khashei  

if i have 2 CI and both of them capture mouse clicks.

How to recognise wich click iss for wich indicator ? 

phi nuts
2184
phi nuts  
pumper:

if i have 2 CI and both of them capture mouse clicks.

How to recognise wich click iss for wich indicator ? 

Pumper, if it is click on chart, you know that can't be done, perhaps some sort of click on button will solve the problem

Anyway, what the click on second indicator do ?

Documentation on MQL5: Standard Constants, Enumerations and Structures / Chart Constants / Types of Chart Events
Documentation on MQL5: Standard Constants, Enumerations and Structures / Chart Constants / Types of Chart Events
  • www.mql5.com
Standard Constants, Enumerations and Structures / Chart Constants / Types of Chart Events - Documentation on MQL5
Mohsen Khashei
648
Mohsen Khashei  

I made it with adding a  button to each indicator

To add comments, please log in or register