Get x and y coordinates in strategy tester - visual mode

 

Hi guys,

need to get x and y coordinates of the chart in visual mode. Is there any way to do this?

I use ChartXYToTimePrice() in real mode and I call this function in OnChartEvent to get X and Y coordinates by click on chart.

But OnChartEvent() is not working in strategy tester - visual mode .

 
Martin Moreno: But OnChartEvent() is not working in strategy tester - visual mode .
See In backtest OnTimer() not performs (M. Ali) - MQL4 programming forum and work around Chart Event For MT4 Backtester (Migel) - MQL4 programming forum
 

I've never had reason to do this in the tester, but I suppose that you could use say an arrow object.

Check in OnTick() to see if the object is selected. If it is set a static bool to true.

Move the object anchor point with the mouse and de-select it.

Every tick, if the bool is true, check to see is it is now de-selected

in which case, set the bool to false and get the time/price co-ordinates of the object anchor and then the x/y co-ordinates.

 
Keith Watford:

I've never had reason to do this in the tester, but I suppose that you could use say an arrow object.

Check in OnTick() to see if the object is selected. If it is set a static bool to true.

Move the object anchor point with the mouse and de-select it.

Every tick, if the bool is true, check to see is it is now de-selected

in which case, set the bool to false and get the time/price co-ordinates of the object anchor and then the x/y co-ordinates.

Thank you Keith

Reason: