Inserted Code
string order_type () { if(OrderType() == OP_BUY) return "BUY"; if(OrderType() == OP_SELL) return "SELL"; if(OrderType() == OP_BUYLIMIT) return "BUYLIMIT"; if(OrderType() == OP_SELLLIMIT) return "SELLLIMIT"; if(OrderType() == OP_BUYSTOP) return "BUYSTOP"; if(OrderType() == OP_SELLSTOP) return "SELLSTOP"; return ""; }
You should pass the type into a parameter and perhaps do something like this.
Inserted Code
string order_type_to_str(int type) { return StringSubstr(EnumToString((ENUM_ORDER_TYPE)type), 11); }