Comparing 3 doubles

 
Hi All

I wonder if anyone can help me.
I have read all the posts on this subject on the forum, and I know there are problems trying to compare doubles. I have also looked at the function in stdlib which compares 2 doubles, which .
Is it possible to compare more than two doubles at a time I have tried comparing three doubles using NormalizeDouble but it does not work.
Here is my code where I have tried to compare 3 doubles:
modify = NormalizeDouble(OrderOpenPrice(),4);
modify1 = NormalizeDouble(OrderTakeProfit(),4);
OrderSelect(tickarray[1],SELECT_BY_TICKET,MODE_TRADES);
modify2 = NormalizeDouble(OrderTakeProfit(),4);
OrderSelect(tickarray[2],SELECT_BY_TICKET,MODE_TRADES);
modify3 = NormalizeDouble(OrderTakeProfit(),4);
if (Buys==true)
{if ((modify+(level3*Point)) == modify1 &&  (modify+(level3*Point))== modify2 && (modify+(level3*Point)) == modify3)
{L3test =true; Print ("Check Modify Level 3 success");}
else
{L3=false;Print ("Check Modify Level 3 failed");


Can anybody show me how to do this?

Many Thanks
Mark

 
You didn't Normalize after adding...


{if ((modify+(level3*Point)) == modify1 && (modify+(level3*Point))== modify2 && (modify+(level3*Point)) == modify3)
 
Hi phy

Is this what you mean how i should do it, will it work better this way:

{if ((NormalizeDouble(mod-modify1,4)==0) && (NormalizeDouble(mod-modify2,4)==0) && (NormalizeDouble(mod-modify3,4)==0))

Thanks for your time
Mark
 
Yes. You normalized, then performed a new operation to get a new value that was not normalized...

It's a pain in the butt...

You might try to arrange your logic in the future to use <= and >= on comparisons to avoid compariosn of equality on doubles
 
Hi Phy

Many Thanks for your help
Regards
Mark