This EA closes all the trades when everything either reaches a set positive or negative amount. However, when no trades are open it has a problem. "Zero Dived in EA" (see attachment) then the entire EA stops. I need help in what to do to my EA to make it so when no trades are open it will continue to wait until more trades open and the profit/loss criteria are met. (Then continue on, and so on and so forth)
Files:
close_all_positions_at_profit_target.mq4
6 kb
Screenshot_20181118-220155.png
430 kb
- Modifying a Position - Trade - MetaTrader 5 for Android
- Modifying a Position - Trade - MetaTrader 5 for iPhone
- Request Execution - Opening and Closing Positions - Trade - MetaTrader 5 for iPhone
fly2hi:
This EA closes all the trades when everything either reaches a set positive or negative amount. However, when no trades are open it has a problem. "Zero Dived in EA" (see attachment) then the entire EA stops. I need help in what to do to my EA to make it so when no trades are open it will continue to wait until more trades open and the profit/loss criteria are met. (Then continue on, and so on and so forth)
This EA closes all the trades when everything either reaches a set positive or negative amount. However, when no trades are open it has a problem. "Zero Dived in EA" (see attachment) then the entire EA stops. I need help in what to do to my EA to make it so when no trades are open it will continue to wait until more trades open and the profit/loss criteria are met. (Then continue on, and so on and so forth)
Hi,
When there is no open position, then you may check your code :
" MarginPercent ", MathRound((AccountEquity()/AccountMargin())*100), NL,
Yohana Parmi:
Ah, gotcha thanks, what should I change it to then?
Hi,
When there is no open position, then you may check your code :
fly2hi:
Ah, gotcha thanks, what should I change it to then?
Ah, gotcha thanks, what should I change it to then?
The easiest way is a condition for your string Comment before you use it :)
similar with this :
if (position_total>0) sComment = sComment + " | Current Margin Level: "+DoubleToString((AccountEquity()/AccountMargin())*100,2)+"% |";
and fyi -- you can find some experienced coders are available at
https://www.mql5.com/en/job
good luck
Trading applications for MetaTrader 5 to order
- www.mql5.com
Hi, I would like to offer a Job for MQL4 Expert Advisor Update - Adding or replacing an indicator in an Expert Advisor. Current Expert Advisor working charming. And I would like to make it more aggressively charms and powerful. I have been dealing with Phil so many times. Really likes his works. Thank you Hi Abhishek, I got a new task for...
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