Wrong logic validation

 

Why is not giving true with two true results?


Print((PositionsTotal() == 0));

Print((PositionsTotal() == 1));

Print((enPositionType == POSITION_TYPE_BUY));

Print(((PositionsTotal() == 1) && (enPositionType == POSITION_TYPE_BUY)));  


2021.09.14 06:30:43.688 2021.09.01 04:45:00   false

2021.09.14 06:30:43.688 2021.09.01 04:45:00   true

2021.09.14 06:30:43.688 2021.09.01 04:45:00   true

2021.09.14 06:30:43.688 2021.09.01 04:45:00   false

 
  1. We have no idea what the direction of your output. Next time use:

    #define PRINT(A) PrintFormat("%s=%g",#A, (A))

  2. Always post all relevant code. We have no idea what enPositionType is.

  3. Terminal version? 1340 works fine for me.

    2021.09.14 08:07:48.395    testscr AUDCAD,Daily: ((p==1)&&(t==OP_BUY))=1
    2021.09.14 08:07:48.395    testscr AUDCAD,Daily: (t==OP_BUY)=1
    2021.09.14 08:07:48.395    testscr AUDCAD,Daily: (p==1)=1
    2021.09.14 08:07:48.395    testscr AUDCAD,Daily: (p==0)=0
      int p=1, t=OP_BUY;
      PRINT((p == 0));
      PRINT((p == 1));
      PRINT((t == OP_BUY));
      PRINT(((p == 1) && (t == OP_BUY)));