OrderType() Functionality in MQL5

 

Quick question. I'm trying to convert some code from mql4 to mql5 but having some trouble.

How do I express the below conditional in mql5? 

if(OrderType() == OP_BUY) 


Also, is it still possible to select orders by position instead of ticket only like in mql4?

 

For  OPEN POSITION:

if ((ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_BUY)

For PENDING ORDER:

if ((ENUM_ORDER_TYPE)OrderGetInteger( ORDER _TYPE)==ORDER_TYPE_BUY)

Reason: