- You have no idea what your values are. Use the debugger or print out your variables, and find out why.
if(FirstOrderType==1) else if(FirstOrderType==0)
Don't hard code constants, use the proper enumerations.
Order Properties - Trade Constants - Standard Constants, Enumerations and Structures - MQL4 Referencereturn(1); return(0);
Your function returns a bool, not an int/double. Return true/false.An if/else means you do A or B and then C if(condition){ A } else { B } C
When the last part of A is a return/break/continue there is no C. Simplify your code. if(condition){ return; } B C
whroeder1:
- You have no idea what your values are. Use the debugger or print out your variables, and find out why.
- Don't hard code constants, use the proper enumerations.
Order Properties - Trade Constants - Standard Constants, Enumerations and Structures - MQL4 Reference - Your function returns a bool, not an int/double. Return true/false.
An if/else means you do A or B and then C When the last part of A is a return/break/continue there is no C. Simplify your code.
I have the idea..
i have the parameter A. Imagine it can be any real number.
If it is bigger than 2, the function check another condition say condition2. if it is true the function returns true and if the condition2 is false the function returns false.
if it is smaller than -2 the function also check for condition2. here if it is true the function returns false and if the condition2 is false the function returns true.
for values between -2 and 2 it returns false.
constant double d; bool function() {//beginning of function double a=it is generate here inside the function; if(a<-d){ if(condition2) return(true); if(!condition2) return(false); { if(a>d){ if(condition2) return(false); if(!condition2) return(true); { return(false); }//End of function
if( condition2) return(true); if(!condition2) return(false);Simplify your code. Increase Order after stoploss - MQL4 and MetaTrader 4 - MQL4 programming forum
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
I wrote a boolean function .
This code always returns false. I wrote some print order to check the program.
I have the value of the deviation and the function prints the calculated value of Parameter2. Most of times it meets the conditions (Parameter2<=-deviation) or (Parameter2>=deviation)
but it still returns false.
The end section:
works fine. When the two other conditions don't meet programs reach two this point and print order executes and then return 0.
but for the if and else if statement it doesn't work.