Selecting first order opened
i think you have to iterate trough all you open orders (if you want to use only currently open orders) or trough your history and compare the OrderOpenTime
i am thinking of something like:
int order=0; datetime first=0; for(int i=OrdersTotal()-1;i>=0;i--){ OrderSelect(i,SELECT_BY_POS); if(OrderSymbol()==Symbol()){ if(first==0 || OrderOpenTime()<first){ first=OrderOpenTime(); order=OrderTicket(); } } } return (order);
just wrote this code here, nothing tested...
good luck
[...] but i have some difficulties to code it with the function orderselect.
i think you have to iterate trough all you open orders (if you want to use only currently open orders) or trough your history and compare the OrderOpenTime
i am thinking of something like:
just wrote this code here, nothing tested...
good luck
Thanks @zzuegg This helped me a lot, 20yrs after
Hi,
I would like to select in an EA the first order opened in the current symbol (not necessary opened with an EA) to collect some information (OrderOpenPrice, StopLoss...) but i have some difficulties to code it with the function orderselect.
Does anyone know how to do it ?
Thanks for your help.
TAAD