+ Reply to Thread
Results 1 to 2 of 2
 0 Attachment(s)    

Thread: Trading to certain days and hours

  1. #1
    Junior Member
    Join Date
    Jan 2009
    Posts
    6

    Default Trading to certain days and hours

    Funyoo.

    How easy/difficult is it to write a code to limit trading to certain days and hours?

    I have tried a number of ways but end up with a pile of errors.

    For example:
    extern bool TradeOnSunday=true; //time filter on sunday
    extern bool MondayToThursdayTimeFilter=true; //time filter the week
    extern int MondayToThursdayStartHour=8; //start hour time filter the week
    extern int MondayToThursdayEndHour=17; //end hour time filter the week
    extern bool FridayTimeFilter=false; //time filter on friday
    extern int FridayStartHour=8; //start hour time filter on friday
    extern int FridayEndHour=14; //end hour time filter on friday

    If Friday =false then close off all open orders on friday

    Thanks

    HiwayNZ


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

    Default

    Quote Originally Posted by HiwayNZ View Post
    Funyoo.

    How easy/difficult is it to write a code to limit trading to certain days and hours?

    I have tried a number of ways but end up with a pile of errors.

    For example:
    extern bool TradeOnSunday=true; //time filter on sunday
    extern bool MondayToThursdayTimeFilter=true; //time filter the week
    extern int MondayToThursdayStartHour=8; //start hour time filter the week
    extern int MondayToThursdayEndHour=17; //end hour time filter the week
    extern bool FridayTimeFilter=false; //time filter on friday
    extern int FridayStartHour=8; //start hour time filter on friday
    extern int FridayEndHour=14; //end hour time filter on friday

    If Friday =false then close off all open orders on friday

    Thanks

    HiwayNZ

    Hi HiwayNZ,

    An example for friday :

    Code:
    if(DayOfWeek()==5)return(0);
    More informations : DayOfWeek - MQL4 Documentation

+ Reply to Thread

Similar Threads

  1. Comments on trade for 2 days
    By hymera in forum Manual systems demo statements
    Replies: 9
    Last Post: 02-11-2010, 10:07
  2. Two Hours EA
    By funyoo in forum Expert advisors backtesting
    Replies: 0
    Last Post: 04-17-2009, 18:00
  3. Error for the EA that trade in the same hours everyday
    By alexlsy in forum MQL programming
    Replies: 1
    Last Post: 03-12-2009, 17:22

Posting Permissions

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