Links are for the russian site!
Nice article indeed.
void CheckStartDateInTradeHistory() { //--- initial interval, as if we started working right now datetime curr_start=TimeCurrent()-days*PeriodSeconds(PERIOD_D1); //--- make sure that the start limit of the trade history has not gone //--- more than 1 day over intended date if(curr_start-start>PeriodSeconds(PERIOD_D1)) { //--- we should correct the start date of history to be loaded in the cache start=curr_start; PrintFormat("New start limit of the trade history to be loaded: start => %s", TimeToString(start)); //--- now load the trade history for the corrected period again HistorySelect(start,end); //--- correct the number of deals and orders in the history for further comparison history_orders=HistoryOrdersTotal(); deals=HistoryOrdersTotal(); } }
see the last two lines?
should they be:
history_orders=HistoryOrdersTotal(); // okay, looks correct
deals=HistoryDealsTotal(); //a typing error, perhaps?
Thanks a lot. This really helped me solve some confusions.
Regards,
Umer Aziz
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
New article Trade Events in MetaTrader 5 is published:
A monitoring of the current state of a trade account implies controlling open positions and orders. Before a trade signal becomes a deal, it should be sent from the client terminal as a request to the trade server, where it will be placed in the order queue awaiting to be processed. Accepting of a request by the trade server, deleting it as it expires or conducting a deal on its basis - all those actions are followed by trade events; and the trade server informs the terminal about them.
Author: MetaQuotes