+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 20
 1 Attachment(s)    

Thread: Time filter

  1. #1
    Member
    Join Date
    Jan 2009
    Posts
    126

    Default Time filter

    Hi guys. I need a hand. I do not know anything about programming but I need to add a timefilter to the pipmaker15_3 EA found here: http://www.tradingsystemforex.com/id...r-v15-3-a.html

    It has an option atthe moment where I can prevent a trade on a particular date, but that is no good to me. I would like to trade the asian session and see how it works.

    Can someone do it for me?

    Thanks in advance.

  2. #2
    Junior Member
    Join Date
    Jan 2009
    Posts
    13

    Default

    adding my voice to viv108

    the time filter & risk management in this ea is not completed
    when this option activated , the ea does'nt work by back testing
    please help in this matter
    Thanks

  3. #3
    Member
    Join Date
    Jan 2009
    Posts
    126

    Default

    Let's hope someone helps us out here..

  4. #4
    Member
    Join Date
    Jan 2009
    Location
    Austria
    Posts
    310

    Default

    for me, time filter and risk management are different tasks

    here is a basic time filter:

    extern bool TimeTrading=true;
    extern int StartHour=0;
    extern int StartMinute=0;
    extern int EndHour=8;
    extern int EndMinute=0;


    //---------Check Time Range----------
    if(((Hour()>StartHour)&&(Hour()<EndHour))
    || (Hour()==StartHour&&Minute()>=StartMinute)
    || (Hour()==EndHour&&Minute()<EndMinute))
    TimeTrading=true;
    else (part is optional! if you want to close orders outside the time)
    {
    CloseBuyOrders(Magic);
    CloseSellOrders(Magic);
    return(0);
    }

    my 2c

  5. #5
    Member
    Join Date
    Jan 2009
    Posts
    126

    Default

    do i need to add the code to the EA?

  6. #6
    Member
    Join Date
    Jan 2009
    Posts
    151

    Default

    That logic is flawed. All it will do is to continually return the bool "TimeTrading" as being true.

    You need to do something like this:

    In Global Scope

    extern int StartHour=0;
    extern int StartMinute=0;
    extern int EndHour=23;
    extern int EndMinute=59;


    Inside the start() function

    //---------Check Time Range----------
    bool operating=false;
    if(
    ((Hour()>StartHour)&&(Hour()<EndHour))
    || (Hour()==StartHour&&Minute()>=StartMinute)
    || (Hour()==EndHour&&Minute()<EndMinute)
    )
    operating=true;


    Then, as part of your entry conditions before the OrderSend() function, you must add:

    &&operating

    The operating condition should not form a part of your exit conditions.

    Setting the start time to 0:00 and the end time to 23:59 means that it will trade continually.
    PipRider.com - The home of the PipRider EA. From $100 to over $1m in 10 year backtest, and it works LIVE too!!

  7. #7
    Ale
    Ale is offline
    Junior Member
    Join Date
    Aug 2009
    Posts
    14

    Default

    In this EA you can define particular dates for "trading pause starts / ends" like this:

    StartTime = 151430; // Trading pause starts at day 15 hour 14, minute 30
    EndTime = 151510; // Trading pause ends at day 15 hour 15, minute 10


    So try this: find in EA code this line (#867):

    PHP Code:
          int t=TimeDay(TimeCurrent())*10000+TimeHour(TimeCurrent())*100+TimeMinute(TimeCurrent()); 
    and replace with this code:

    PHP Code:
          if(startTime 2401 && endTime 2401) {
             
    startTime startTime TimeDay(TimeCurrent())*10000;
             
    endTime endTime TimeDay(TimeCurrent())*10000;
          }
          
    int t=TimeDay(TimeCurrent())*10000+TimeHour(TimeCurrent())*100+TimeMinute(TimeCurrent()); 
    Compile. Now you can enter not only particular dates, but particular times too:

    StartTime = 1430; // Trading pause starts every day at hour 14, minute 30
    EndTime = 1510; // Trading pause ends every day at hour 15, minute 10


    Sorry, Im not testing, only read code :)

  8. #8
    Member
    Join Date
    Jan 2009
    Posts
    126

    Default

    just replaced your code with the original one - tried to decomple and now getting a message saying that ' 'start time' variable not defined' and also ' 'end time variable' not defined'. Any ideas?

  9. #9
    Ale
    Ale is offline
    Junior Member
    Join Date
    Aug 2009
    Posts
    14

    Default

    No ideas. Attached code with this replacement do not produce compilation errors
    Attached Files
    Last edited by Ale; 09-12-2009 at 19:26.

  10. #10
    Member
    Join Date
    Jan 2009
    Posts
    126

    Default

    Quote Originally Posted by Ale View Post
    No ideas. Attached code with this replacement do not produce compilation errors
    You total legend!

+ Reply to Thread
Page 1 of 2 1 2 LastLast

Similar Threads

  1. XMA filter - new trend filter, check it out
    By Metatrader7 in forum Ideas for expert advisors
    Replies: 13
    Last Post: 05-09-2010, 08:06
  2. Add a time filter
    By funyoo in forum MQL programming
    Replies: 12
    Last Post: 05-28-2009, 21:26
  3. Mesir Time EA
    By ahlan042000 in forum Expert advisors backtesting
    Replies: 14
    Last Post: 03-13-2009, 13:18
  4. 2 time frame stochs filter
    By automatic in forum Ideas for expert advisors
    Replies: 1
    Last Post: 12-19-2008, 18:11

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts