Chart event handling: click coordinates

 

Hi,

I'm experimenting with graphical objects (like dialog) and chart events, and I was wondering wether if there's a mapping of the candles for the click event coords or not, I mean, if my expert has a Cue Line to track candle operations (stored by candle time), am I able to move that Cue Line around the chart by clicking on a particular candle?

I tried to search the web and the forum as well, but I found no relevant threads, only on how to separate chart clicks from object clicks (also useful info). I made the expert to print the actual coords, but I could not find a way to bind those coords to the candles themselves (yet).

Can I find info on this topic somewhere?

 
Documentation on MQL5: Chart Operations

ChartXYToTimePrice

Converts the X and Y coordinates on a chart to the time and price values

iBarShift

Returns the index of the bar corresponding to the specified time

Documentation on MQL5: Chart Operations
Documentation on MQL5: Chart Operations
  • www.mql5.com
Chart Operations - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Fernando Carreiro #:
Documentation on MQL5: Chart Operations

ChartXYToTimePrice

Converts the X and Y coordinates on a chart to the time and price values

iBarShift

Returns the index of the bar corresponding to the specified time

Thank you, never saw that function. I will look into it, and will come back with the results shortly.

 
Yap, that did the trick. It was strange that it's a function of bool type, and it changes the datetime value by reference, I haven't worked with such functions yet. I also had to figure out that the same applies to the subwindow parameter, didn't see the reason behind it, but now I realized that the user might not only click in the main chart window (0). Anyways, thanks for the recommendation, @Fernando Carreiro. Wonder why I couldn't find it via Google.