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,003

    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

Similar Threads

  1. Manual trading forex success and every-days
    By ForexAndy in forum Commercial manual systems
    Replies: 0
    Last Post: 03-22-2015, 13:20
  2. Forex trading session - GMT hours
    By fxtester in forum Trading discussion
    Replies: 0
    Last Post: 02-27-2015, 17:56
  3. My more than 100% profit in 9 days
    By timidave in forum Manual systems statements
    Replies: 11
    Last Post: 12-15-2012, 22:19
  4. Resume Trading after X Days after MaxLots?
    By sleepypipsCDN in forum MQL programming
    Replies: 4
    Last Post: 06-17-2009, 08:49
  5. Two Hours EA
    By funyoo in forum Expert advisors backtesting
    Replies: 0
    Last Post: 04-17-2009, 19:00

Tags for this Thread

funyoo, hours, limit, mql, time, 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
  •