Page 1 of 2 12 LastLast
Results 1 to 10 of 20
 1 Attachment(s)    

Thread: Time filter

  1. #1

    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

    Default

    Let's hope someone helps us out here..

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

    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

    Default

    do i need to add the code to the EA?

  6. #6

    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.

  7. #7
    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

    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
    Junior Member
    Join Date
    Aug 2009
    Posts
    14

    Default

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

  10. #10

    Default

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

Similar Threads

  1. Mandor EA time filter
    By EaLabSpain in forum Ideas for expert advisors
    Replies: 0
    Last Post: 04-10-2012, 20:36
  2. Add a time filter
    By sunyc1982 in forum MQL programming
    Replies: 3
    Last Post: 02-27-2011, 18:53
  3. Time filter code
    By himnoor in forum MQL programming
    Replies: 0
    Last Post: 12-21-2010, 02:55
  4. Req. Trading Time Filter
    By Trint in forum Ideas for expert advisors
    Replies: 0
    Last Post: 01-23-2010, 09:19
  5. Add a time filter
    By funyoo in forum MQL programming
    Replies: 12
    Last Post: 05-28-2009, 22:26

Tags for this Thread

100, add, broker, color, date, dmi, expert, guide, magic, programming, server, stop, test, thank you, time, timefilter, trading

Posting Permissions

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