elanin: I want EA to find data from latest closed order in account history that has special comment.
For large amounts of code, attach it
- https://www.mql5.com/en/forum/139121
- Comments can be overwritten by brokers which is what you're looking for. Other brokers do NOT modify the comment.
elanin:
Please edit your post . . . Have problem where I want EA to find data from latest closed order in account history that has special comment.
I do not know mql language so good and have problem to figure out logic how to solve this problem
<CODE REMOVED>
Please use this to post code . . . it makes it easier to read.
Found some more information in very good post about loops https://www.mql5.com/en/forum/139654 and keyword from for me was to use continue; to loop down/up (not sure yet:)) account history until located needed information
//-- Information from history orders int hst, hstType, hstTicket, hstCloseTime, hstOpenTime, hstOrder, check; double hstClosePrice, hstOpenPrice, hstProfit, hstStopLoss, hstTakeProfit; string OrderName; for(hst=0;hst<hstTotal;hst++) { if(OrderSelect(hst,SELECT_BY_POS,MODE_HISTORY)==false) { Alert("Access to history failed with error ",GetLastError()); } if(OrderSymbol()==Symbol()) { for(hstOrder=0;hstOrder<hstTotal;hstOrder++) if(!OrderSelect(hstOrder,SELECT_BY_POS,MODE_HISTORY)==true)continue; if( OrderComment()=="Sell[tp]" || OrderComment()=="Sell[sl]") check=0; hstType=OrderType(); hstTicket=OrderTicket(); hstCloseTime=OrderCloseTime(); hstOpenTime=OrderOpenTime(); hstClosePrice=OrderClosePrice(); hstOpenPrice=OrderOpenPrice(); hstProfit=OrderProfit(); hstStopLoss=OrderStopLoss(); hstTakeProfit=OrderTakeProfit(); } }
Anyway this mystery is solved for me and now up to the next looping mystery..

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
Have problem where I want EA to find data from latest closed order in account history that has special comment.
I do not know mql language so good and have problem to figure out logic how to solve this problem