What does OrderType() > OP_SELL mean?

Hello,

What does OrderType() > OP_SELL mean? There are a few instances in the EA I am working with that have some if conditions with OrderType() > OP_SELL . I understand that OrderType() == OP_SELL means it should be equal to a sell order, and OrderType() != OP_SELL means it should not be equal to a sell order. But what does it mean when OrderType() is greater than OP_SELL ?

Codes from EA :

if(OrderSymbol() != Symbol() || OrderType() > OP_SELL)

continue;

if(OrderType() > OP_SELL)

OrderDelete(OrderTicket());

hi, something from documentation OrderType - Trade Functions - MQL4 Reference

1 Like

OrderType() returns an integer which represents the type of order (buy, sell, buylimit, buystop, etc).

Presumably what this line of code is saying is any order type greater than sell. This is assuming that buylimit, buystop, selllimit, sellstop have integer values greater than sell’s integer value.

It’s not the clearest way to say this in code, in my opinion. You might be better to make specific checks, like this:

if(OrderType() == OP_BUYLIMIT || OrderType() == OP_BUYSTOP || OrderType() == OP_SELLLIMIT || OrderType() == OP_SELLSTOP)

Or more simply:

if(OrderType() != OP_BUY && OrderType() != OP_SELL)

Hope that helps!

1 Like

Its just checking if the order is a buy stop, sell stop, buy limit or sell limit.

1 Like