GetLastBusinessDay returns previous calendar day. Does not handle market holidays. Assumes broker's time zone includes Sunday.
Nabeel Bashir: Basically I want my EA to print the NET profit for today only, including both close and open positions.
Then why are you selecting the previous day, not today?

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Why did you post your coding question in the MT5 General section (a miscellaneous catch-all category) instead of the MT5 EA section (non-indicator coding)?
General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
Next time, post in the correct place. I have moved this thread.
I wrote the below MQL5 function to calculate today's profit for my EA. This is not working as expected and I cannot spot the bug. Can someone help me?
Basically I want my EA to print the NET profit for today only, including both close and open positions.