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 all,
I am trying to write an EA that will monitor my account and then close all orders based on AccountEquity()+Target$.
The idea is the EA loads and sets a variable that represents an equity target. It also sets a variable to compare order dates to by using CheckDate = TimeCurrent(). Then on a timer it loops through closed orders checking that it only adds the profit for orders OrderOpenTime()>= CheckDate. Then it adds that to the AccountEquity(). If the history + AccountEquity() > AccountEquity() + Target then close all orders.
The idea is this will be used for scalping/grid EAs that sometimes eat up the account. The way to minimise the risk is to reach a profit number and then close all orders - lock that profit in. I figure if I can get several of these scalping/grid EAs running together a separate EA that monitors the account can close them all which will average the risk out over several pairs.
Trouble is it doesn't work.
For some reason the EA closes all the orders and AccountEquity() is lower than the target. When there are only a few orders it looks fine but add more pairs and for some reason it just closes the orders.
Any assistance or pointers where to look is gratefully accepted.