
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
Yes, it is coupled with the LoweIsEmpty and UpperIsEmpty because it must be one of those. It can only be 0 and 1 or 1 and 0... - It can never be 1 and 1 or 0 and 0...
That is the reason for it. And it is coupled because I need to know if my EA is getting the right SuperTrend, more specifically any value of the SuperTrend. But it looks like that my EA isn't getting the value...
That is the reason why I'm getting #02 or #03 error...
No, it is not the reason because both ifs cannot be true at the same time
You should be using something like
Alert("Supertrend error");
Alert("Supertrend error");
bool isBothTrue = LowerIsEmpty && UpperIsEmpty;
if(isBothFalse || isBothTrue)
Alert("Supertrend error");
I tried to code it with bool but the problem was that I got wrong results... so I changed to 0 and 1...
But however, how can I fix my problem.. I don't understand why my code isn't working..
whroeder1:
Alert("Supertrend error");
bool isBothTrue = LowerIsEmpty && UpperIsEmpty;
if(isBothFalse || isBothTrue)
Alert("Supertrend error");
As I said in my earlier post
I don't know whether UpperIsEmpty and LowerIsEmpty are bools or ints. Ideally they should be bools and you should use true or false instead of 0 and 1.
You are using 0 for true and 1 for false which is the opposite of the way they will be read by other coders.
I looked at the code again and actually there is no need for the alerts #2 and #3, they are already covered with
if(sT_l == EMPTY_VALUE && sT_u != EMPTY_VALUE){
Comment("sT_l == EMPTY_VALUE && sT_u != EMPTY_VALUE");
UpperIsEmpty = 1;
LowerIsEmpty = 0;
}else if(sT_l != EMPTY_VALUE && sT_u == EMPTY_VALUE){
Comment("sT_u == EMPTY_VALUE && sT_l != EMPTY_VALUE");
UpperIsEmpty = 0;
LowerIsEmpty = 1;
}else{
Alert("Error by getting SuperTrend! - Please inform the programmer! #01");
}
I tried to code it with bool but the problem was that I got wrong results... so I changed to 0 and 1...
But however, how can I fix my problem.. I don't understand why my code isn't working..
I have the same problem ,i think the the condition expression if(var!=empty_value) is not easy to get true result ,it should be replaced by if(!(var==empty_value)) .
though it looks the same in logic , in practical ,I get really different result !
the value of EMPTY_VALUE is 2147483647 (0x7FFFFFFF) ,it is an int type , if a indicator buffer is double type ,
is it accurate when use expression if(var!=empty_value) or if(var==empty_value) ?
if(a == X) // always true
if(a == X) // always true
then, as we know,indicator buttor is defined as double type , if an indicator have normal value of 1.0 and EMPTY_VALUE ,
in an ea ,we will use the value ,which method is correct in following expression ?
if(var!=empty_value) / if(var==empty_value) / if(var!=1.0) or if(var==1.0)
thank you .