1. Welcome back! Thank you for being a part of this Traders Community. Let's discuss and share :)
    Selamat datang kembali! Trimakasih telah menjadi bagian dari Komunitas Trader ini. Mari berdiskusi dan berbagi :)
    Dismiss Notice

Bug Nilai IF selalu bernilai betul

Discussion in 'Belajar MQL dari Nol' started by Azzam971, 16 Aug 2019.

  1. Azzam971

    Azzam971 New Member

    Equity
    Credit
    Ref Point
    Haloo agan semua

    Saya tadi kan nulis

    Int output=0;
    Double Low1=Low[1];
    Double Low2=Low[2];

    //Low1 = 1.27001
    //Low2 = 1.27058

    If(Low1> Low2) output = 1;

    Harusnya kan bernilai salah/false/0
    Kok selalu bernilai 1/true yaa??
    Adakah yang tahu ??
    Thanks
     
  2. stadevata

    stadevata Active Member Credit Hunter

    Equity
    Credit
    Ref Point
    karena ga ada "else' atau "if' yg lainnya mungkin mas

    If(Low1> Low2) output = 1;
    If(Low1< Low2) output = 0;
    else output = 2;
     
  3. Azzam971

    Azzam971 New Member

    Equity
    Credit
    Ref Point
    Baik, thanks infonya
     
  4. Winda Esti

    Winda Esti Member Credit Hunter

    Equity
    Credit
    Ref Point
    int vOUTPUT()
    {
    Int output=0;
    Double Low1=Low[1]; Double Low2=Low[2];
    If(Low1> Low2){output = 1;}
    return(output);
    }

    jalankan fungsinya di onTick() mas

    void OnTick()
    {
    Print("Output=",vOUTPUT());
    }
     

Share This Page