How do you list all tickets of open trades?

 
I have some open trades in meta trader, how do I list all their tickets? 
All I found in mql documents is about how to get the ticket of a "selected" order before 
I have some orders which no one is selected, I need a list of oreders tickets, then I select one of them by first ticket then do some actions on it, then 2nd ticket, etc..
 

Why don't you tray yourself the example in the editor's reference for OrdersTotal:

int handle=FileOpen("OrdersReport.csv",FILE_WRITE|FILE_CSV,"\t"); 
  if(handle<0) return(0); 
  // write header 
  FileWrite(handle,"#","open price","open time","symbol","lots"); 
  int total=OrdersTotal(); 
  // write open orders 
  for(int pos=0;pos<total;pos++) 
    { 
     if(OrderSelect(pos,SELECT_BY_POS)==false) continue; 
     FileWrite(handle,OrderTicket(),OrderOpenPrice(),OrderOpenTime(),OrderSymbol(),OrderLots()); 
    } 
  FileClose(handle);
 
 
gooly:

Why don't you tray yourself the example in the editor's reference for OrdersTotal:


Thanks for responding... 
Im amateur
May ask you explain this code? I think its not related to what I need
This is the story:
My ea recive a command which say change stop loss to 1.0000 of the order which have 1.1111 in take profit
So EA has to retrieve all open orders in order to compare take profites with which the command said(1.1111) this process returns me the right order to modify
All this process need to start by obtaining all open orders tickets
 
Mahmood000:

Thanks for responding... 
1) Im amateur
2) May ask you explain this code? 3) I think its not related to what I need
4) This is the story:
My ea recive a command which say change stop loss to 1.0000 of the order which have 1.1111 in take profit
So EA has to retrieve all open orders in order to compare take profites with which the command said(1.1111) this process returns me the right order to modify
All this process need to start by obtaining all open orders tickets

1) We all started as amateurs and in my case reading and studying the code of other helped me a lot to leave being an amateur!

2) That's not - according to my understanding - an educating forum. You have the reference where you find all you need to understand the code.

3) I think you have to start from there at least.

4) I don't really understand what you want  - may you look for someone in the freelance office?

 
gooly:

1) We all started as amateurs and in my case reading and studying the code of other helped me a lot to leave being an amateur!

2) That's not - according to my understanding - an educating forum. You have the reference where you find all you need to understand the code.

3) I think you have to start from there at least.

4) I don't really understand what you want  - may you look for someone in the freelance office?

Hahaha ok gooly
I'm almost done with my ea that's my last problem

Reason: