All you need is in here: https://docs.mql4.com/trading
static datetime lastClose; datetime lastClosePrev = lastClose; for(int pos=0; pos < OrdersHistoryTotal(); pos++) if ( OrderSelect(pos, SELECT_BY_POS, MODE_HISTORY) // Only orders w/ && OrderCloseTime() > lastClosePrev // not yet processed, && OrderMagicNumber() == magic.number // my magic number && OrderSymbol() == Symbol() // and my pair. && OrderType() <= OP_SELL){// Avoid cr/bal forum.mql4.com/32363#325360 lastClose = OrderCloseTime(); if (OrderProfit() ...
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
I want to write a code is based on if last order profit or lost, how can i do that??