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
TAAD:
https://www.mql5.com/en/forum/126165
[...] but i have some difficulties to code it with the function orderselect.
thanks for your help.
zzuegg #:
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
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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