"(OrderType()

 

While tracking down a program or logic error I encountered this snippet of code that did not originate from me that seems that it is neither valid nor true:

"(OrderType() <= OP_SELL)"

It is part of 'looping' through an array:

 isNewBar();  // Go Trading ONLY at the Start of a New Bar!

   bool IsTrade = False;

   int TradesTotal = ArraySize(Trades) - 1;

   int TradesSorted = ArraySort(Trades, WHOLE_ARRAY, 0,MODE_ASCEND);
   
for (int i = 0; i < TradesSorted; i ++)
   {
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if(OrderType() <= OP_SELL) &&  OrderSymbol() == Symbol())
      {
         IsTrade = True;
         if(OrderType() == OP_BUY)

It would seem that it should be either a logical 'false' != or 'true' : ==. Likely the former.

Thanks for any and all assistance! (< 8)

 

It is valid : OP_SELL is a predefined constant with value 1 ;

OP_BUY = 0

so if you only want to allow buy and sell orders, this check would do the trick


HTH