ObjectMove the ChartRedraw object does not change size

To add comments, please log in or register
samjesse
645
samjesse  

Hi

This part code modifies the rectangle so that its lower edge (price) changes accordingly, But when the code is fired, the rectangle does not move its lower edge to reflect the lower price than the current rectangle lower edge.

How do I go about finding the problem? Thanks

//myfile.mq5

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
                  )
  {
  if(id==CHARTEVENT_CLICK)
    {
      sessions[0].resize(SymbolInfoDouble(_Symbol, SYMBOL_BID));
    }
  }

// object.resize is a public method of a class in myfile.mqh
  void resize(double bid){
    if(!ObjectMove(0, mRectName, 2, mT2, 1.31142)){     //1.31142 happened to be much lower than the rectangle lower edge, mT2 is the current time of the second anchor point
      Print(__FUNCTION__, ": failed to move the anchor point! Error code = ",GetLastError());  //this line does not print
    } else{
      Print("redrawing");  //this line prints fine
      ChartRedraw();
    }
  }







To add comments, please log in or register