Jump to content

⤴️-Paid Ad- Check advertising disclaimer here. Add your banner here.🔥

Recommended Posts

Posted (edited)

I am developing an EA which I would like to stop when it reaches a profit of 2% in a day.

 

Previously I just declared a variable called AccBalance and then set it to AccountBalance() in the initialization function and then do the multiplication to create the balance that the EA will stop at. However, a limitation of this method is that if I have to restart the EA, change a variable, etc, then the EA the 2% target will restart, even if I have made 1.5% that day already.

 

Therefore, I was wondering if there is a way to find out the account balance history, e.g. midnight last night.

 

I have an idea of how to do it, which is quite complex. It would be to make a while loop when selecting trades. While the date of the trade is the current date, subtract the profit from the trade from AccountBalance().

 

This is quite complex and I was wondering whether there is a preset function in the MQL library which does this?

Edited by chrisbenjy
  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

⤴️-Paid Ad- Check advertising disclaimer here. Add your banner here.🔥

×
×
  • Create New...