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

Thread: Time filter logic is wrong

  1. #1
    Junior Member kyojee's Avatar
    Join Date
    Jan 2009
    Posts
    19

    Default Time filter logic is wrong

    Hi funyoo,

    Thanks for your good job.

    I've found the problem.
    I think your time filter logic is wrong.

    Example
    gmtshift=0;
    starthour=20;
    endhour=7;

    if date change 23:59 -> 00:00
    then TimeCurrent() increase 86400

    PHP Code:
    (nstarthour>nendhour && TimeCurrent()<tstart && TimeCurrent()>tend)) 
    'TimeCurrent()>tend' become wrong result.

    Thank you
    Regards,
    Last edited by kyojee; 12-16-2009 at 02:43.

  2. #2
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    Quote Originally Posted by kyojee View Post
    Hi funyoo,

    Thanks for your good job.

    I've found the problem.
    I think your time filter logic is wrong.

    Example
    gmtshift=0;
    starthour=20;
    endhour=7;

    if date change 23:59 -> 00:00
    then TimeCurrent() increase 86400

    PHP Code:
    (nstarthour>nendhour && TimeCurrent()<tstart && TimeCurrent()>tend)) 
    'TimeCurrent()>tend' become wrong result.

    Thank you
    Regards,
    Hi kyojee,

    Here is the last version of my template.

    I don't get errors in backtesting. I have added some comments for this scenario nstarthour>nendhour.

    Heiken Ashi Ma is for the example.
    Attached Files Attached Files

  3. #3
    Junior Member kyojee's Avatar
    Join Date
    Jan 2009
    Posts
    19

    Default time filter logic is wrong

    Hi funyoo,

    Thanks for your reply.

    OK, backtest may work correctly.
    But real live does not.

    Let me show you these screen shots.
    I got it yesterday.
    This is your codes.

    Local time is 23:59 (JST)
    I got it with using Windows API (dll).

    Time filter logic is wrong-time_2359-jpg

    Next, local time is 00:00 (JST)
    See tstart, tend!



    I think this is maybe MT4 terminal's spec.
    If I modify it correctly with using your coes, how about this?

    string svrdate = Year()+"."+Month()+"."+Day();
    :
    tstart=StrToTime(svrdate+" "+istarthour+":"+istartminutes);
    :
    tend=StrToTime(svrdate+" "+iendhour+":"+iendminutes);
    :
    like this,



    Thank you,
    Regards
    Attached Images Attached Images Time filter logic is wrong-time_2359-jpg Time filter logic is wrong-time_2400-jpg Time filter logic is wrong-time_2403_correct-jpg 
    Last edited by kyojee; 12-18-2009 at 00:08.

  4. #4
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    Hi kyojee,

    Thanks for your support,

    That's a bright idea, I will update my template.

  5. #5

    Exclamation

    Quote Originally Posted by funyoo View Post
    Hi kyojee,

    Thanks for your support,

    That's a bright idea, I will update my template.
    Hi! If possible please let the new template be available for downloading here, thanks in advance!

  6. #6
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    Quote Originally Posted by szmvscla View Post
    Hi! If possible please let the new template be available for downloading here, thanks in advance!
    Hi szmvscla,

    Here it is.
    Attached Files Attached Files

  7. #7

    Exclamation

    Quote Originally Posted by funyoo View Post
    Hi szmvscla,

    Here it is.
    Thanks a lot, but the TF isn't updated, please upload the new version after you update the TF.
    Last edited by szmvscla; 12-21-2009 at 16:05.

  8. #8
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    Quote Originally Posted by szmvscla View Post
    Thanks a lot, but the TF isn't updated, please upload the new version after you update the TF.
    Hi szmvscla,

    You just need to remove this // this /* and this */ in the code to release the time filter.

  9. #9

    Question

    Quote Originally Posted by funyoo View Post
    Hi szmvscla,

    You just need to remove this // this /* and this */ in the code to release the time filter.
    I know it. Did you already updated it like kyojee suggested to you?

  10. #10
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    Quote Originally Posted by szmvscla View Post
    I know it. Did you already updated it like kyojee suggested to you?
    Yes, the code has been updated.

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. Time filter
    By Viv108 in forum MQL programming
    Replies: 19
    Last Post: 05-25-2011, 12:07
  3. Add a time filter
    By sunyc1982 in forum MQL programming
    Replies: 3
    Last Post: 02-27-2011, 18:53
  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

backtest, backtesting, change, date, dmi, funyoo, live, mt4, real, support, time

Posting Permissions

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