Guarda come scaricare robot di trading gratuitamente
Ci trovi su Twitter!
Unisciti alla nostra fan page
Script interessante?
Pubblica il link!
lasciare che altri lo valutino
Ti è piaciuto lo script? Provalo nel Terminale MetaTrader 5
Visualizzazioni:
7540
Valutazioni:
(34)
Pubblicato:
2013.01.28 10:29
Aggiornato:
2016.11.22 07:32
\MQL5\Include\ \MQL5\Scripts\
Hai bisogno di un robot o indicatore basato su questo codice? Ordinalo su Freelance Vai a Freelance

The "Day of Week" function is designed to determine the number of required month according to data of the week and the day of the week inside this month. For example, we need the third Friday in February, 2000 or the fourth Wednesday in November, 1998. The function allows to determine the number of search day.

The idea of creating this function came to me when I was writing the indicator and came across many dates connected with the definite days of the week in the month. For example, there are such dates as Martin Luther King, Jr. Day which is celebrated on the third Monday of January. I could not find this day using the standard functions. As the days of the week are repeating every 28 years, the idea was just to enter the data for the next 10 years and do not create this function, but I like difficulties that is why I decided to make it anyhow.

Function parameters:

  • int year - a year,
  • int month - a month,
  • int day_o_w - the day of the week required (Monday=1, Tuesday=2,..., Sunday=7),
  • int sequence - the number of the day of the week in this month (from 1 to 5, when enter the fifth day, if this day is absent in this month, then the previous, i.e. the fourth day will output).

The example of using this function in the code:

Required: the second Friday in February, 1980.

The code for obtaining this number:

int day=func_day_o_w(1980,2,5,2);

Required: the last Thursday in December, 2013

The code for obtaining this number:

int day=func_day_o_w(2013,12,4,5);

Also the "DayOfWeek.mq5" script is attached. It uses this function to find the date according to the first example (the second Friday in February, 1980)

Input parameters:


The result:


 

Check the result using Windows OS time bar:


Tradotto dal russo da MetaQuotes Ltd.
Codice originale https://www.mql5.com/ru/code/1470

MaxMinRange MaxMinRange

Two histograms to define the current market situation

ExTrend ExTrend

The channel formed by two trend lines drawn at the high and low formed by the last two fractals

Range Range

The Range indicator calculates the range expansion index and displays the range of price change in the current bar

Exp_ColorCoppock Exp_ColorCoppock

The trade system using the ColorCoppock oscillator.