Jump to content

Account Balance at midnight


chrisbenjy

Recommended Posts

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
Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...