chrisbenjy Posted June 19, 2010 Report Share Posted June 19, 2010 (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 June 19, 2010 by chrisbenjy Quote Link to comment Share on other sites More sharing options...
hein123 Posted July 4, 2010 Report Share Posted July 4, 2010 This EA sound interesting, would you share it once finished. I am not able to help you yet as I am just learning MQL currently Quote Link to comment Share on other sites More sharing options...
soundfx Posted July 4, 2010 Report Share Posted July 4, 2010 Why not store the midnight account balance as a global variable? GlobalVariableSet and GlobalVariableGet are the functions to use. Quote Link to comment Share on other sites More sharing options...
iwjw Posted July 4, 2010 Report Share Posted July 4, 2010 (edited) deleted... Edited July 4, 2010 by iwjw Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.