# OrderHistoryTotal() for current Day?

7386

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?

929

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(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);
}```
929

you must set account history to all history also
Moderator
10566

```   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
7386

GumRai:
should do the trick
Got it. Thanks to Subgenius n GumRaj