void SignalFunction() { if(EnterTradeFunction()) //You are calling a void function CaseNumber++; } //SignalFunction End void EnterTradeFunction(){ //Change this to a bool function and code it to return true or false OrderSend(Symbol(),ordertype,(CaseNumberChecking()*0.01),price,Slippage,0,0,"Comment",0,0,clrNONE)); } //EnterTradeFunction EndI imagine that as you are calling a void function, your if() cannot be true

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
I'm relatively new to MQL4 and have been loving it, however I have run into a problem.
I have created an EA and I need to access variable: 'CaseNumber' from multiple functions and also change it.
I have error checking in my code and everything else seems to be functioning correctly only 'CaseNumber' is not being changed.
I have tried 'CaseNumber' as a global variable as well with much the same result.
Here are the basics of my code so to show the situation when using 'CaseNumber' on the global scope:
________________________________________________Also using 'CaseNumber' as a local variable and calling it:
________________________________________________
I understand that when I am calling it locally it is setting 'CaseNumber' back to '0' every tick but I don't know how to prevent that because my Signal and Trailing Stop functions both need the 'CaseNumber' variable as well as need to be called from the OnTick function.
I realize this is such a newbie problem but help would be so much appreciated.