Download MetaTrader 5

POSITION_PRICE_OPEN

To add comments, please log in or register
milfordT
128
milfordT  

After entering multiple buy orders (which Metrader combines into one buy order), when I call  PositionGetDouble(POSITION_PRICE_OPEN) it returns the open price of the next to last buy position opened rather than the last one opened.  Does anyone know why?

 Thanks

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Position Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Position Properties - Documentation on MQL5
Alexey Da
Moderator
6601
Alexey Da  
milfordT:

After entering multiple buy orders (which Metrader combines into one buy order), when I call  PositionGetDouble(POSITION_PRICE_OPEN) it returns the open price of the next to last buy position opened rather than the last one opened.  Does anyone know why?

 Thanks

Please provide exact description of actions you did. 

milfordT
128
milfordT  
alexvd:

Please provide exact description of actions you did. 

Here's the piece of my code:

 

   double currPrc;
   double openPrc;
   double priceChg;

   CPositionInfo *CPosnPtr = new CPositionInfo;    // position object

   if (CPosnPtr.Select(_Symbol) == true)  // we have an opened position
   {
      // check current and last open price
      currPrc = CPosnPtr.PriceCurrent();
      openPrc = CPosnPtr.PriceOpen();
...

 

After about the 4th order The PriceOpen() call starts returning the next to last open price. 

To add comments, please log in or register