Download MetaTrader 5

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

To add comments, please log in or register
Articles can help you to solidify your knowledge. Come and read them!
Sherif Hasan
7289
Sherif Hasan 2015.09.24 19:41 

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
9596
Keith Watford 2015.09.24 22:32  
Simple, only use orders opened/closed today in the calculations
Sherif Hasan
7289
Sherif Hasan 2015.09.25 04:41  
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
9596
Keith Watford 2015.09.25 05:34  
   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
7289
Sherif Hasan 2015.09.25 06:14  
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