Make a flag
int start() { static int loopCount, messageCount; static bool Flag = false; if(AccountEquity()>2000 && Triggered == false) { messageCount++; ShowMessageBox(); Flag = true; } loopCount++; Comment("\n Loopcount = "+loopCount+"\n MessageCount = "+messageCount); return(0); } void ShowMessageBox() { Messagebox("This is the Messagebox"); }
Great! Exactly what I was looking for. Many Thanks!!
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
Hello
With MQL4, I have always the same problem in general. Take a look at the following code:
Problem is, as soon as the Equity is over 2000, the message box is shown at EVERY tick move. Even when the messagebox is closed, it appears again at the next tick (of course only when the equity is over than 2000).
The messagebox is only an example. Instead of a messagebox, I use another code i. e. to open Limit orders. But there is the same problem as with the messagebox.
Is it modify the code so that as soon as the equity is over 2000 the following code executes only once, and then never again no matter what happens?