# Check price every tick and open Order when certain price is reached

Guys I have no ideia why I cant make this simple operation in my  EA code work.

I first tried to compare the doubles of both prices but I realized that there is something tricky about comparing doubles so I decided to apply some math instead but still cant make it work.

```double H3 = ((yesterday_high - yesterday_low)* D3) + yesterday_close;

double L3 = yesterday_close - ((yesterday_high - yesterday_low)*(D3))

void OnTick()
{

if(Close[0] - L3 == 0){

Print("L3 price hit");

Sleep(60000);

if(Close[0] - L3 > 0 && !L3TradeOpen){

magicNumber++;
}

}

if(Close[0] - H3 == 0) {

Print("H3 price hit");

Sleep(60000);

if(Close[0] - H3 < 0 && !H3TradeOpen){

Print("Sell Order:" + IntegerToString(TicketSellOrder));
magicNumber++;
}

}
}

```

angomes:

I first tried to compare the doubles of both prices but I realized that there is something tricky about comparing doubles so I decided to apply some math instead but still cant make it work.

and yet you are still comparing Doubles.

```if(Close[0] - L3 == 0){
}

if(Close[0] - H3 == 0) {
} ```

If you want to determine if a level is hit, you first need to know whether price starts above or below the level.

If it starts above the level, check for if price is <= the level, then you will know that price has hit or crossed the level.

When comparing doubles you should avoid using the "==" operator. Only use ">" or "<" operators.
Reason: