I want to add a take profit and stop loss based on account profit or equity. So let say the account increases 50 buck it would close all open trades and start a new round of trades. How could I impliment such a function. If someone could give me some code to achieve this it would be greatly appreciated thank you
- code help for opening and closing position OnTick - MT5
- Simple open and close code ?
- I'm new at this
Virtualknight wrote >>
I want to add a take profit and stop loss based on account profit or equity. So let say the account increases 50 buck it would close all open trades and start a new round of trades. How could I impliment such a function. If someone could give me some code to achieve this it would be greatly appreciated thank you
I want to add a take profit and stop loss based on account profit or equity. So let say the account increases 50 buck it would close all open trades and start a new round of trades. How could I impliment such a function. If someone could give me some code to achieve this it would be greatly appreciated thank you
if (accountequity > accountbalance) Close AllOrders;
See here https://docs.mql4.com/account
EADeveloper wrote >>
if (accountequity > accountbalance) Close AllOrders;
See here https://docs.mql4.com/account
Sorry, of course
if (accountequity >= accountbalance+50) Close AllOrders;
Virtualknight wrote >>
I want to add a take profit and stop loss based on account profit or equity. So let say the account increases 50 buck it would close all open trades and start a new round of trades. How could I impliment such a function. If someone could give me some code to achieve this it would be greatly appreciated thank you
I want to add a take profit and stop loss based on account profit or equity. So let say the account increases 50 buck it would close all open trades and start a new round of trades. How could I impliment such a function. If someone could give me some code to achieve this it would be greatly appreciated thank you
Here it is
Files:
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