I guess I should be asking if I can actually get OrdersHistoryTotal() and limit the return to show the closed trades for today only ?
I mean I know I can Print(OrdersHistoryTotal()); and this will give me the total orders of whatever I select in the tab of the account history.
If I select Account History and change the dates to custom/today then I get the OrderHistoryTotals for today.
However, what to do if I don't change the Account History to show only one day then how would I go about finding this out.
Please advise, thanks
void SELECT_TRANSACTIONS_CLOSED_TODAY_ONLY()
{
for(int i=OrdersHistoryTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==true)
if(TimeDay(OrderCloseTime())==Day()&&OrderSymbol()==Symbol())
//......here goes your code what to do about those orders...example...
Print(OrderProfit()+OrderTicket());
}
}
this function would find orders that you want to process:)Cheers:)
if ( TimeDay ( OrderCloseTime () ) == Day () )
it is important:)
![Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions](https://c.mql5.com/36/39/documentation-on-mql5-constants__55.png)
- www.mql5.com
void SELECT_TRANSACTIONS_CLOSED_TODAY_ONLY()
{
for(int i=OrdersHistoryTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==true)
if(TimeDay(OrderCloseTime())==Day()&&OrderSymbol()==Symbol())
//......here goes your code what to do about those orders...example...
Print(OrderProfit()+OrderTicket());
}
}
this function would find orders that you want to process:)Cheers:)
if ( TimeDay ( OrderCloseTime () ) == Day () )
it is important:)
I see, thanks.
I'll play with this some tomorrow and check returns to see what it's telling me.
Thanks.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I guess I should be asking if I can actually get OrdersHistoryTotal() and limit the return to show the closed trades for today only ?
I mean I know I can Print(OrdersHistoryTotal()); and this will give me the total orders of whatever I select in the tab of the account history.
If I select Account History and change the dates to custom/today then I get the OrderHistoryTotals for today.
However, what to do if I don't change the Account History to show only one day then how would I go about finding this out.
Please advise, thanks