What does OrderType() > OP_SELL mean?

shanmugapradeep

Active Trader
Dec 18, 2020
119
5
34
39
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 :

MQL4:
if(OrderSymbol() != Symbol() || OrderType() > OP_SELL)
continue;
 
if(OrderType() > OP_SELL)
         OrderDelete(OrderTicket());
 

hayseed

Master Trader
Jul 27, 2010
1,114
271
149
usa
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 :

MQL4:
if(OrderSymbol() != Symbol() || OrderType() > OP_SELL)
continue;
 
if(OrderType() > OP_SELL)
         OrderDelete(OrderTicket());
//------

orders are listed numerically by type...... order properties......

op_buy has a value of 0......

op_sell has a value of 1......

the limit and stop orders values are 2 thru 6......

so your code is saying if (ordertype is > 1) continue;..... this in effect would only pass buy and sell orders...... so it probably should read, if(ordertype is < 1) continue;.....

as written, the following line in your code would never see a pending order that it could delete......
 
  • 👍
Reactions: Enivid

Enivid

Administrator
Staff member
Nov 30, 2008
19,064
1,473
144
Odesa
www.earnforex.com
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 :

MQL4:
if(OrderSymbol() != Symbol() || OrderType() > OP_SELL)
continue;
 
if(OrderType() > OP_SELL)
         OrderDelete(OrderTicket());
Just as @hayseed said, it means "skip pending orders". I just want to add that it's quite a bad way to code this. It's faster to type, but it creates unnecessary confusion, which could be avoided by either enumerating all market orders (buy and sell) or all pending orders (stop/limit buy/sell). The cited code snippet could be faster, but such coding style makes code maintenance and debugging rather more difficult.