There are two deals involved with each trade. One to enter and the other to exit. You should count those exit deals.
int TodayRealizedCount() { int count=0; datetime day_start=(int)(TimeCurrent()/(24*3600))*24*3600; if(HistorySelect(day_start, TimeCurrent())) { int total = HistoryDealsTotal(); for(int i = 0; i < total; i++) { ulong dealTicket = HistoryDealGetTicket(i); if(HistoryDealGetInteger(dealTicket, DEAL_ENTRY) == DEAL_ENTRY_OUT) { count++; } } } return count; }
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
trying to count total number of trades closed. but it shows twice the number for each trade. one when it opens and one as it closes. anyone can help please?