Why m_position.Volume() always return a "0"?

 

Hi,

In my EA, I need to adjust the volume according to m_position.Volume(), but it always return "0" during the beginning of  test, but  later, it jump to a big number, like 47666668, the numberjump very fast to an other big number like 1043269, then it stay at 47013514. It is not the volume that I hold in the position, it look like a trade volume of the whole market.

Can anybody help?

Thanks a lot

Documentation on MQL5: Standard Constants, Enumerations and Structures / Indicator Constants / Price Constants
  • www.mql5.com
Standard Constants, Enumerations and Structures / Indicator Constants / Price Constants - Documentation on MQL5
 

Just checking, have you called the method  CPositionInfo::Select(symbol) before to call CPositionInfo::Volume() ?

 

Yes, I did call CPositionInfo::Select(symbol) before I use it. But the Volume change so much, not for my holding position.

I think I should use: PositionGetDouble(POSITION_VOLUME)

Thanks.

Documentation on MQL5: Trade Functions / PositionGetDouble
  • www.mql5.com
Trade Functions / PositionGetDouble - Documentation on MQL5
Reason: