Need Help.

 

Dear Sir,

Is there someone can help me ? I need to record the value of a number (example 5) marketorders (open position) which are the value of the OrderTicket(), OrderOpenPrice(), OrderLots(), OrderClosePrice() and OrderCloseTime().

I think we need to use array variable to solve that problem. Is there someone can help me to give the algorithm or the coding ? I tried to make the coding, but always fail.

Thank You very much.

 
Show your code where you tried to do this using an array and we can help . . .
 
RaptorUK:
Show your code where you tried to do this using an array and we can help . . .

I can copy from mql4-editor, so I attach that file. tks
Files:
 

Here:

double MyLot=0.1;
int MyMagic=1234;
int AddSL=0;
int AddTP=10;
int Ticket[10];
datetime CloseTime[10];
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
    
    
    int  MySL=MarketInfo(Symbol(),MODE_STOPLEVEL)+AddSL;
    int MyTP=MarketInfo(Symbol(),MODE_STOPLEVEL)+AddTP;
    int k=0;
    for(int i=0; i<=OrdersTotal(); i++)
      {
        OrderSelect(k,SELECT_BY_POS,MODE_TRADES);
        if(OrderSymbol()!=Symbol())continue;
        int Ticket=OrderTicket();
        Ticket[k]=Ticket;
        CloseTime[k]=OrderCloseTime();      
        k=k+1; 
        Alert("Ticket=", Ticket[i],"\n","CloseTime=",CloseTime[k]); 
      }
    if(k!=0)
      {
        checkMartingale(Symbol());
      }else 
      {
        OrderSend(Symbol(),OP_BUY,MyLot,Ask,3,Bid-MySL*Point,Bid+MyTP*Point,0,0,0,Green);
      }
  
//----
   return(0);
  }
//+-------------------------------------------------------------------+
//--------------------------------------------------------------------+

int checkMartingale(string symbol)
   {
    
    return(0);
   }
 
Your Alert is wrong, you increment k just before the Alert . . . move the Alert to before the line where you increment k . . . and Ticket[i] should be Ticket[k]
 
RaptorUK:
Your Alert is wrong, you increment k just before the Alert . . . move the Alert to before the line where you increment k . . . and Ticket[i] should be Ticket[k]


Its Ok.

Thank You Very Much Mr. RaptorUK.

Reason: