Seabass:
I am trying to figure out how to implement ordershistory to get my EA to go to the next day
I am trying to figure out how to implement ordershistory to get my EA to go to the next day
datetime lastClose; for(int pos=0; pos < HistoryTotal(); pos++) if ( OrderSelect(pos, SELECT_BY_POS, MODE_HISTORY) // Only orders w/ && OrderCloseTime() > lastClose // not yet processed, && OrderMagicNumber() == magic.number // my magic number && OrderSymbol() == Symbol() // and my pair. && OrderType() <= OP_SELL){ // Avoid cr/bal forum.mql4.com/32363 lastClose = OrderCloseTime(); } datetime lastCloseDay = lastClose - (lastclose % 86400), toDay = Time[0] - (Time[0] % 86400); // Assume Period != D1 bool tradingAllowed = toDay != lastCloseDay;
WHRoeder
Thanks very much.
I am in the process of trying to incorporate this right now. I certainly appreciate the help.
Cheers

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 everyone,
I am trying to figure out how to implement ordershistory to get my EA to go to the next day regardless of what whether its a gain or a loss. Right now i am using seprate subs to go to the next day but it is becoming cumbersome. I thought I could simply use the orders history function to check and see if there is any closed trades on the current date I would just jump to the next day. Unfortunately when I try to do this....well I'm a nube at this and somewhere my syntax or logic has an error. Anybody have any insite as to how to code this. It seems simple. Any help would be appreciated.
Cheers