I can't close partial orders using dialog class

 

Hello.

I am using the dialog class to create a trading panel. It's almost finished. What is missing is the function of partially closing orders, which is giving me a headache. I get an error message when trying to use the partial close function.

The order ticket is picked up correctly, so I dont know what is wrong.

Anyone have any idea?


Function to close partial which I am using:


void Painel::OnClickBotaoParcial(void)
  {
   const int pos = PositionGetInteger(POSITION_TICKET);
   Comment(pos);
   if(!m_trade.PositionClosePartial(pos,0.01,ULONG_MAX)) {MessageBox("Error closing position "+m_trade.ResultComment(),"Error",MB_ICONERROR|MB_OK);return;}
   ChartRedraw();
  }