inconvenient for the "combine Positions" function of MT5

 

actually the "combine Positions" function of MT5 make coder trouble,

because 

if you using 2 strategy on a single symbol, and the exit condition is base on the position open time , it would be trouble, if you have 2 orderSend record -->  you only see the oldest position open time !

can anyone tell me what is the advavtange of "combine Positions" function ?

if none, i strongly hope developer can change MT5 to "seperate Position" function

thanks 

 
Have you already read this article?
 
alexvd:
Have you already read this article?

hi. alexvd

 so , it is inconvenient to do lots of  "magic number decoding" for getting those different open time of different EA

 

allow seperate position is the best method to solve this

 
kelly:

actually the "combine Positions" function of MT5 make coder trouble,

because 

if you using 2 strategy on a single symbol, and the exit condition is base on the position open time , it would be trouble, if you have 2 orderSend record -->  you only see the oldest position open time !

can anyone tell me what is the advavtange of "combine Positions" function ?

if none, i strongly hope developer can change MT5 to "seperate Position" function

thanks 

Try this: (not tested, hope it works OK)

datetime PositionOpenTime() // open time of first Deal in open position.
{
   uint total=0;
   long ticket;
   datetime OpenTime;
   long pos_id;

   if(PositionSelect(_Symbol)) // continue if open position for symbol
    {
      pos_id=(ENUM_POSITION_PROPERTY_INTEGER)PositionGetInteger(POSITION_IDENTIFIER);
      HistorySelectByPosition(pos_id);

      ticket=HistoryDealGetTicket(1); // get ticket number for 1st trade in open position
      OpenTime=HistoryDealGetInteger(ticket,DEAL_TIME);
    }

return(OpenTime);
}


Reason: