Don't use " == " with doubles if possible.
Doubles don't compare for equality easily.
Search this forum for "NormalizeDouble" and see the problems others have encountered.
Another "classical" approach is to define following function:
bool Equal(double va11, double val2)
{
double delta = 1 * Point; // set your own value
if(MathAbs(va11 - val2) <= delta)
return(true);
else
return(false);
}
and then make following comparison:
if(Equal(level, 0.9222))
{
Print("level has been reached");
}

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
Hi,
I am trying to create a loop with range of parameter called 'level'. This parameter is type of double.
I wrote the following lines:
Print("level ",level);
if(level == 0.9222 )
{
Print("level has been reached");
}
This condition is always false even I see that level 0.9222 is being reached (in the log file).
Can someone tell me please what is the problem?
Is 'if' condition works on 'double' type?
Thanks,
Ziv