Download MetaTrader 5

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

To add comments, please log in or register
MyDream
343
MyDream  

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
Jin
1539
Jin  

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

 

MyDream
343
MyDream  

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
To add comments, please log in or register