probem Holiday with data1 and data2

Questions about MultiCharts and user contributed studies.
turbofib
Posts: 213
Joined: 11 May 2013
Has thanked: 67 times
Been thanked: 1 time

probem Holiday with data1 and data2

Postby turbofib » 17 Dec 2021

hi, the day after the holiday how can I code that the day before on data1 there was no data and on date2 yes?
Attachments
mc1.png
(34.76 KiB) Not downloaded yet

User avatar
Tammy MultiCharts
Posts: 200
Joined: 06 Aug 2020
Has thanked: 6 times
Been thanked: 65 times

Re: probem Holiday with data1 and data2

Postby Tammy MultiCharts » 20 Dec 2021

Hello turbofib,

There is no direct way to do that.
You can determine whether there was a working day or a holiday according to the bar's date.
Here's a basic example you can refer to:

Code: Select all

var: weekend(true); var: weekday(0); weekend = DayOfWeekFix(date) > 5; weekday = DayOfWeekFix(date); if(not weekend) then begin print(datetimetostring_ms(datetime), " ", DayOfWeekFix(date)); if weekday[0] > weekday[1] then begin if absvalue( datetime[1] - datetime[0]) >= 1 then begin value1 = text_new_dt(datetime, high + 1, " holiday "); text_setsize(value1 , 15); end else begin value2 = text_new_dt(datetime, high + 1, " working day "); text_setsize(value2 , 15); end; end; end; If weekday[1] - weekday[0] >= 4 then begin value3 = text_new_dt(datetime, high + 1, " weekend "); text_setsize(value3 , 15); end;

turbofib
Posts: 213
Joined: 11 May 2013
Has thanked: 67 times
Been thanked: 1 time

Re: probem Holiday with data1 and data2

Postby turbofib » 20 Dec 2021

Hello turbofib,

There is no direct way to do that.
You can determine whether there was a working day or a holiday according to the bar's date.
Here's a basic example you can refer to:

Code: Select all

var: weekend(true); var: weekday(0); weekend = DayOfWeekFix(date) > 5; weekday = DayOfWeekFix(date); if(not weekend) then begin print(datetimetostring_ms(datetime), " ", DayOfWeekFix(date)); if weekday[0] > weekday[1] then begin if absvalue( datetime[1] - datetime[0]) >= 1 then begin value1 = text_new_dt(datetime, high + 1, " holiday "); text_setsize(value1 , 15); end else begin value2 = text_new_dt(datetime, high + 1, " working day "); text_setsize(value2 , 15); end; end; end; If weekday[1] - weekday[0] >= 4 then begin value3 = text_new_dt(datetime, high + 1, " weekend "); text_setsize(value3 , 15); end;
HI, thanks for answer...
i ask you a question : why you use DayOfWeekFix(date)(it use datejulien) instead of DayOfWeek(date)?

User avatar
Tammy MultiCharts
Posts: 200
Joined: 06 Aug 2020
Has thanked: 6 times
Been thanked: 65 times

Re: probem Holiday with data1 and data2

Postby Tammy MultiCharts » 21 Dec 2021

Hello turbofib,

There is no difference.
You can use the DayOfWeek(date) keyword as well as the function DayOfWeekFix(date).
We provided you with a sample code, which you can modify as you prefer.


Return to “MultiCharts”