probem Holiday with data1 and data2
- Tammy MultiCharts
- Posts: 200
- Joined: 06 Aug 2020
- Has thanked: 6 times
- Been thanked: 65 times
Re: probem Holiday with data1 and data2
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:
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;
Re: probem Holiday with data1 and data2
HI, thanks for answer...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;
i ask you a question : why you use DayOfWeekFix(date)(it use datejulien) instead of DayOfWeek(date)?
- Tammy MultiCharts
- Posts: 200
- Joined: 06 Aug 2020
- Has thanked: 6 times
- Been thanked: 65 times
Re: probem Holiday with data1 and data2
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.
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.