Download MetaTrader 5

How to get Account History for current day? need suggetions?

To add comments, please log in or register
Sherif Hasan
7387
Sherif Hasan  

I need to show the following details in chart, which is current day history!

Total Orders Count,Gross Profit,Gross Loss, Net P/L

the above details i must get every day and next day the all values must be reset?

need suggetion?

when i tried it shows total orders history value, wherever i use OrdersHistoryTotal()

Your help is appreciated!

Keith Watford
Moderator
10569
Keith Watford  
Simple, only use orders opened/closed today in the calculations
Sherif Hasan
7387
Sherif Hasan  
GumRai:
Simple, only use orders opened/closed today in the calculations

Yes Gumraj! , you are right! i stuck in begin the code. i need the exact logic to start my code?

Keith Watford
Moderator
10569
Keith Watford  
   int closed_orders=0;
   datetime today_midnight=TimeCurrent()-(TimeCurrent()%(PERIOD_D1*60));
   for(int x=OrdersHistoryTotal()-1; x>=0; x--)
     {
      if(OrderSelect(x,SELECT_BY_POS,MODE_HISTORY) && OrderCloseTime()>=today_midnight)
         closed_orders++;
     }
This counts closed orders. You can build on it to calculate the other values
Sherif Hasan
7387
Sherif Hasan  
GumRai:
This counts closed orders. You can build on it to calculate the other values
Thanks GumRaj. got it. You are awesome for helping people.
To add comments, please log in or register