Send order when specific price is reached

 

Dear All,

I trying something simple but its not working...can somone be kind enough to tell me what im doing wrong ?

The EA should buy when EURUSD is between 1.4501 and 1.4510.

The code for that is:

  extern double WB=1.4500;
 if(PRICE_CLOSE>(WB+0.0001) && PRICE_CLOSE<(WB+0.0010))
     ticket_buy=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point,"Hearbeat 15 min",12345,0,Green);
     

Unfortunatly it doesn't work.....

Oddly enought if it is done this way...

   if(PRICE_CLOSE>(WB+0.0001))
     {ticket_buy=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point,"Hearbeat 15 min",12345,0,Green);
      numpos++;}

I will work correctly, which means that the problem is in this line:

   if(PRICE_CLOSE>(WB+0.0001) && PRICE_CLOSE<(WB+0.0010))

What's wrong with those two conditions ??

Many thanks for your attention,

regards,

 

1. 100% BEST way for u to answer own question is to use Print() statement - u MUST BE SURE that: PRICE_CLOSE and WB contain sensible data.

easy to put in Print()'s and that way only take seconds to find issue...

2. u must also consider [but maybe not for this post] that double values MUST be NormalizedDouble(aDoubleValue,Digits) - something to keep in mind...

Best