Download MetaTrader 5

Get the Month of a closed order?

To add comments, please log in or register
remix919
103
remix919  
How can I use OrderCloseTime() to get the month in digits of a closed order? I'm trying to build a script to filter historical results by month, so I would only want to display order results within a selected month, such as month 11 for November.
Keith Watford
Moderator
10065
Keith Watford  

TimeMonth()

Note, if you have extended trade history, you may also need to check the year 

remix919
103
remix919  

So something like this?

if(OrdHistory>0 && OrderSymbol()==Symbol() && OrderCloseTime() <= TimeMonth())

remix919
103
remix919  
if I want to check the trades only for the current month
Keith Watford
Moderator
10065
Keith Watford  
if(OrdHistory>0 && OrderSymbol()==Symbol() && TimeMonth(OrderCloseTime())==Month())
will check for current month, but as I said, if you have trade history for more than a year, you may need to check the year.
remix919
103
remix919  
ok, thanks =D that worked great!
To add comments, please log in or register