Converting a candle on chart to type Mqlrates[1] on click

 

Hi,

Lets say we have something like this: 

void OnChartEvent(const int id,         // Event identifier  
                  const long& lparam,   // Event parameter of long type
                  const double& dparam, // Event parameter of double type
                  const string& sparam) // Event parameter of string type
  {
//--- the left mouse button has been pressed on the chart
   if(id==CHARTEVENT_CLICK)
     {
      Print("The coordinates of the mouse click on the chart are: x = ",lparam,"  y = ",dparam);
     }
//--- the mouse has been clicked on the graphic object
   if(id==CHARTEVENT_OBJECT_CLICK)
     {
      Print("The mouse has been clicked on the object with name '"+sparam+"'");
     } 

   

 How do I convert sparam to a variable of type MQLrates when I click on a candle ?

 
maindoor:

Hi,

Lets say we have something like this: 

   

 How do I convert sparam to a variable of type MQLrates when I click on a candle ?

A candle is not an object. You can do that this way.
Reason: