At the entrance there are two candles A B. Candle B is transformed into C, according to the following table:

ABC 0 0 1 0 1 0 1 0 0 1 1 1 

Based on the values ​​of two candles A and B, the value of candle C is written to the new database. Moreover, the time of candles is timeA> timeB and timeC == timeB. In MQL, it will be C = ~ (A ^ B).

    1 answer 1

    This is called exclusive or. And in principle, if we guarantee that a and b can be either 1 or 0, then the formula will be such a c = 1-(a^b); or so int c = ~(a ^ b) & 0x01;

    Candle time has nothing to do with the issue.