Search code examples
mql4mt4

Arranging the code for an (X) OR (Y) variable to return TRUE


How would I group a list of (x) variables to be true, OR and group of (y) variables to be true to activate a command.

The following I have here, which includes the || Boolean.

if(OrderSelect(PosSel,SELECT_BY_POS,MODE_TRADES))
                 if(OrderTicket() > 0)
                 if((OrderMagicNumber() == Period()))
                 if(OrderSymbol() == Symbol())
                 if(TimeCurrent() >=(OrderOpenTime() + 60 * Period()))
                 /*Either the above variables can be met OR the one below can be met. */
                 || if((MarketInfo(Symbol(),MODE_BID)==(iOpen(Symbol(),0,1))))

Many thanks.


Solution

  •    if(OrderSelect(PosSel,SELECT_BY_POS,MODE_TRADES)){
          if(OrderMagicNumber() == Period() && OrderSymbol()==Symbol()){
                RefreshRates(); //must call it before accessing Bid & Ask
                if(TimeCurrent()>=OrderOpenTime()+60*Period() || 
                    fabs(Bid-iOpen(Symbol(),0,1))<Point/2){///here 1 OR 2 is true:
                //what to do ?
             }
          }
       }