Download MetaTrader 5

inconvenient for the "combine Positions" function of MT5

To add comments, please log in or register
Manage agents in your profile. It is easy!
LEE Chun Wing
831
LEE Chun Wing 2010.08.11 16:06 

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 

Alexey Da
Moderator
6606
Alexey Da 2010.08.11 16:19  
Have you already read this article?
LEE Chun Wing
831
LEE Chun Wing 2010.08.11 20:02  
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

Wackena
648
Wackena 2010.08.11 20:23  
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);
}


To add comments, please log in or register