Here is one way:
This finds the newest closed trade and if it was a winner, then do your stuff
This finds the newest closed trade and if it was a winner, then do your stuff
double newestTime; int ticket, newestTicket; for(int i = OrdersHistoryTotal() - 1; i >=0 i++){ ticket = OrderSelect(i, SELECT_BY_POS, MODE_HISTORY ); if(OrderSymbol() == Symbol()){ if(OrderCloseTime() > newestTime){ newestTime = OrderCloseTime(); newestTicket = ticket; } } OrderSelect(newestTicket, SELECT_BY_TICKET, MODE_HISTORY); if(OrderProfit() > 0) { ... do stuff }
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
Thx for help.
Jo