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

Tutorial mohon bantuan menambah filter time

Discussion in 'Belajar MQL dari Nol' started by basmanpro, 13 Feb 2023.

  1. basmanpro

    basmanpro New Member

    Equity
    Credit
    Ref Point
    maaf master

    mohon bantuan untuk menambah filter time di file berikut ini

    sdh sy coba dengan kode tapi tidak bisa dicompile, maklum bkn coder

    terimakasih untuk bantuannya

    kode

    di variabel

    extern bool UseTimer=true;
    extern bool UseLocalTime=false;
    extern int StartHour=12;
    extern int StartMinute=00;
    extern int EndHour=19;
    extern int EndMinute=00;

    di Initialize


    if(UseTimer == true)
    {
    string StartConstant = StringConcatenate(StartHour,":",StartMinute);
    string EndConstant = StringConcatenate(EndHour,":",EndMinute);
    datetime StartTime = StrToTime(StartConstant);
    datetime EndTime = StrToTime(EndConstant);

    if(UseLocalTime == true) datetime CurrentTime = TimeLocal();
    else CurrentTime = TimeCurrent();

    if(StartTime <= CurrentTime && EndTime > CurrentTime)
    {
    bool TradeAllowed = true;
    }
    else TradeAllowed = false;
    }
     

    Attached Files:

  2. Niguru

    Niguru Member Credit Hunter

    Equity
    Credit
    Ref Point
    Code:
    if(UseTimer) {
    string StartConstant=StringConcatenate(StartHour,":",StartMinute);
    string EndConstant  =StringConcatenate(EndHour,":",EndMinute);
    datetime StartTime=StrToTime(StartConstant);
    datetime EndTime  =StrToTime(EndConstant);
    datetime CurrentTime;
    //-----------------------------------------------------------------------
    if(UseLocalTime) CurrentTime=TimeLocal(); else CurrentTime=TimeCurrent();
    if(StartTime<=CurrentTime && EndTime>CurrentTime) bool TradeAllowed=true; else return;
    }
      
     

    Attached Files:

  3. Dayut

    Dayut New Member Credit Hunter

    Equity
    Credit
    Ref Point
    Do you have any indicator or ea for time filter means to off ea everyday at specific time
     

Share This Page