MQL5 bug in ChartXYToTimePrice library

 

I am testing code below, and I see there is problem in converting x, y, axis to datetime and price

void OnChartEvent(const int id,         // Event ID
                  const long& lparam,   // Parameter of type long event
                  const double& dparam, // Parameter of type double event
                  const string& sparam  // Parameter of type string events
)
{
  //------------------------------------------------------------------
  if (id==CHARTEVENT_CLICK)
  {
    int x1 = (int)lparam, y1 = (int)dparam, win1 = 0;
    ChartXYToTimePrice(0, x1, y1, win1, dt, price);
    Alert(dt);
  }
  //------------------------------------------------------------------
}

I zoom in maximum, now if we divide whole candle width to two part, when I click on left half of a candle, this function give me previous candle time, while if I click on right half of candle then it return correct candle time

I did not have this bug on mt4 but when I convert to MT5, I saw this problem

 
Hooshang Nosratpanah:

I am testing code below, and I see there is problem in converting x, y, axis to datetime and price

I zoom in maximum, now if we divide whole candle width to two part, when I click on left half of a candle, this function give me previous candle time, while if I click on right half of candle then it return correct candle time

I did not have this bug on mt4 but when I convert to MT5, I saw this problem

There is not bug. MT5 is just not working as MT4. With mql5, ChartXYToTimePrice() returns an exactly calculated datetime, not the time of the nearest candle.
 
Alain Verleyen:
`There is not bug. MT5 is just not working as MT4. With mql5, ChartXYToTimePrice() returns an exactly calculated datetime, not the time of the nearest candle.

thanks for your reply