Problem with " "?

 

Hi,

I have following:

      if( MathAbs(Bid - h1000) < Point*10 )
      {
         Print("Bid: ", DoubleToStr(Bid,8));
         Print("h1000: ", DoubleToStr(h1000,8));
      }
      if( (Bid - h1000) > 0.0)
      {
         Print("Bid > h1000");
         res = DoBuy();
         return;
      }

The first output is

2013.08.17 17:39:42     2013.01.10 13:50  EA_Tickdata EURUSD,H1: Bid: 1.31778000
2013.08.17 17:39:42     2013.01.10 13:50  EA_Tickdata EURUSD,H1: h1000: 1.31775000

Bid is higher then h1000, but the condition check seems to fail.

What is the problem here?

 
  1. did you get this from the log file or the journal tab?
    2013.08.17 17:39:42     2013.01.10 13:50  EA_Tickdata EURUSD,H1: Bid: 1.31778000
    2013.08.17 17:39:42     2013.01.10 13:50  EA_Tickdata EURUSD,H1: h1000: 1.31775000

    The journal is most recent first. Therefor those two lines are unrelated. change your code and retry:

    Print("Bid: ", DoubleToStr(Bid,8)," h1000: ", DoubleToStr(h1000,8));

  2.  if( (Bid - h1000) > 0.0) // exactly the same as if(Bid > h1000)
    See The == operand. - MQL4 forum
 

From journal. Maybe you're right. The two valus are not printed together anymore.

Thanks for the link, I will try the comparision function.

Reason: