POSITION_PRICE_OPEN

 

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
 
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. 

 
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.