OrderHistoryTotal() for current Day?

Back to topics list To post a new topic, please log in or register
avatar
273
sheriffonline 2015.09.06 20:53
 

Is there any standard function to get total closed orders for current day?

eg:

must count only closed orders count day by day!

if there is no standard function available please give me a suggetion to get daily orders count?

avatar
211
Subgenius 2015.09.07 02:13 #
 
sheriffonline:

Is there any standard function to get total closed orders for current day?

eg:

must count only closed orders count day by day!

if there is no standard function available please give me a suggetion to get daily orders count?

try this..ty
int TodaysOrders()
   {
   for(int TotalOrdersCNT=OrdersTotal()-1; TotalOrdersCNT>=0; TotalOrdersCNT--)
      {
      if(OrderSelect(TotalOrdersCNT,SELECT_BY_POS,MODE_TRADES))
         {
         if(TimeDayOfYear(OrderOpenTime())==TimeDayOfYear(TimeCurrent()))
            {
            TotalOrders+=1;
            }         
         }
      }
   for(TotalOrdersCNT=OrdersHistoryTotal()-1; TotalOrdersCNT>=0; TotalOrdersCNT--)
      {
      if(OrderSelect(TotalOrdersCNT,SELECT_BY_POS,MODE_HISTORY))
         {
         if(TimeDayOfYear(OrderOpenTime())==TimeDayOfYear(TimeCurrent()))
            {
            TotalOrders+=1;
            }         
         }
      }
   return(TotalOrders);
   }
avatar
211
Subgenius 2015.09.07 02:15 #
 
you must set account history to all history also
avatar
Moderator
3418
GumRai 2015.09.07 07:00 #
 
   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++;
      }
should do the trick
avatar
273
sheriffonline 2015.09.07 09:15 #
 
GumRai:
should do the trick
Got it. Thanks to Subgenius n GumRaj
Back to topics list  

To add comments, please log in or register