- OrdersHistoryTotal - 1 is the last order or use a for loop to find the last order
if(OrderSelect(OrdersHistoryTotal() - 1,SELECT_BY_POS,MODE_HISTORY)==true)
- you have to compare it against TimeCurrent
if(OrderSelect(1,SELECT_BY_POS,MODE_HISTORY)==true)
- Don't assume. Not the first closed order (zero) not the last (OrdersHistoryTotal()-1)
- OrderSelect loop on history, filter by magic number and symbol, Find the latest OrderCloseTime, then compare.
"i want to check if the last order is minimum one hour old..."
if(OrderSelect(1,SELECT_BY_POS,MODE_HISTORY)==true)
order position 1 is usually not the last closed order.
you can use the for loop to get each history order's close time,and find the latest one(the biggest int),use some filter if needed.
then compare with current time.

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
hello,
i want to check if the last order is minimum one hour old, so i was thinking the
OrderCloseTime()
and datetime
are borth using the date from the 01.01.1970 in seconds
when i use my code i get some unexpected results
i was thinking, i use the order close time minus the actual time and get as result some seconds.
but the resualt is far away from the truth, or it only dosent work at the tester