
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
Sample 2 "Capital defence" in https://www.mql5.com/en/code/8773
double Percent = 30.0;
if ( AccountEquity()*100.0/AccountBalance() <= Percent ) { /*use your imagination here*/ }
great!
Now it prevents the script of trading into losses, after winning szenarios. But sometimes it is still making losses much bigger than the percentage of AccountBalance I entered. I want it to defenately stop when dropping the AccountEquity to that certain level, and close all open positions then.
How could I do that?
Sample 2 "Capital defence" in https://www.mql5.com/en/code/8773
this is a number to high for me, but I try to get into it.
Try to remember inital Account Balance on EA start and than check its value on every tick, as soon as:
current_balance*100.0/initial_balance <= some_value
you can close all and stop.
Try to remember inital Account Balance on EA start and than check its value on every tick, as soon as:
current_balance*100.0/initial_balance <= some_value
you can close all and stop.
the same results as before, I guess I have a mistake in the closing orders code.
how do I properly close all open orders?
Fo Rex