Download MetaTrader 5
To add comments, please log in or register
Post web links to other trader's signals and make profit
web11
286
web11 2016.02.05 14:41 

Dear Guys,

is any MQL function, how i know what is the date of the first friday every months. Example : in February 2016 first Friday of the month, date is : 05-Feb-2016

how i know by MQL function or coding. Please help me

Thanks

Biantoro Kunarto
14539
Biantoro Kunarto 2016.02.06 07:52  

Maybe this script can help you

bool CheckFirstFriday()
 {
   bool result = false;  
   if ( Day() <= 7 && DayOfWeek() == 5 )
      result = true;
   return(result); 
 }
Mohammad Soubra
23070
Mohammad Soubra 2016.02.06 08:02  
biantoro kunarto:

Maybe this script can help you

But this will not give 1st friday in March and next nonthes
Biantoro Kunarto
14539
Biantoro Kunarto 2016.02.06 08:27  

The first script only for checking the current day is First friday

If you want to check the first friday of the march 2016, you can use this script

datetime CheckFriday(int MonthTime, int YearTime)
 {
   datetime result = 0;
   for ( int cnt = 1; cnt <= 7; cnt++ )
      {
         string DateString = IntegerToString(cnt);
         string MonthString = IntegerToString(MonthTime);
         string YearString = IntegerToString(YearTime);
         datetime FridayTime = StringToTime( YearString + "." +
                                             MonthString + "." +
                                             DateString);
         if ( TimeDayOfWeek( FridayTime ) == 5 )
            result = FridayTime;
      } 
   return(result);
 }
Biantoro Kunarto
14539
Biantoro Kunarto 2016.02.06 08:28  

If you want to check the first friday of march 2016, you can type this:

Print(CheckFriday(3,2016));
/
To add comments, please log in or register