OnTeade()
Add the profits of closed positions. Reason_SL, Reason_TP.
Then calculate the max loss based on OpenPrice and SL value, add the two variables and there you get your total.
In OnTrade you can filter by time and date.
Should do the work for you.

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
Hi, I have created an Expert to trade for me when i take the FTMO challenge, The only thing i have left to code is the max daily loss limit.
I need to set a maximum loss of 5% per day, So if i am risking 1% on every trade, after a loss of 4% in the current day the EA must stop trading.
I also need to include the risk in trades that are open as they have the potential to lose. So the code should add up the total profit/loss for the day and then add the total open risk in the account (open trades), If this is above 4% the EA should stop trading.