Download MetaTrader 5

chart event

To add comments, please log in or register
Code Base will help you in mastering your theoretical skills. Come and learn!
Mohsen Khashei
617
Mohsen Khashei 2013.01.23 10:22 

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 2013.01.23 18:36  
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
617
Mohsen Khashei 2013.01.24 05:22  
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
617
Mohsen Khashei 2013.01.26 08:31  

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 2013.01.26 10:02  
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
617
Mohsen Khashei 2013.01.26 15:22  

I made it with adding a  button to each indicator

To add comments, please log in or register