Hi,
I've come up with the following code trying to plot a vertical line on 1st open day of every month. I fail to see what i am missing as it's not plotting right. Can someone please point out the coding error ?
Thank you
---------------
{insert vertical bars every 1st open day of the month}
variables:
txtID (0), // print text on graph
TLID (0), // the vertical line
fday(0), // set fday
d1(0), // debugging in output
third(0),
chkdate(0); //set date of vertical line
once cleardebug;
d1 = dayofweek(date);
if (dayofweek(date) = 0) then // if 1st Day of Month is a Sunday draw vertical line the next Monday
fday=2
else if (dayofweek(date) = 6) then // if 1st Day of Month is a Saturday draw vertical line the next Monday
fday=3
else fday = 1; // else 1st Day of Month is 1 draw vertical line same day
if dayofmonth(date) = fday then
begin
print(d1); // print output
chkdate=date;
TLID =
tl_new(chkdate,900,0,chkdate,900,low-100);
tl_SetColor(TLID, white);
tl_setstyle(TLID, 1);
txtID = Text_New(chkdate, Time, low-50, text(fday));
end;
plot vertical lines on 1st open day of the month [SOLVED]
-
- Posts: 30
- Joined: 22 Mar 2012
- Location: Western Europe
- Has thanked: 6 times
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2223 times
Re: plot vertical lines on 1st open day of the month
You are overthinking it.Hi,
I've come up with the following code trying to plot a vertical line on 1st open day of every month. I fail to see what i am missing as it's not plotting right. Can someone please point out the coding error ?
Thank you
---------------
{insert vertical bars every 1st open day of the month}
variables:
txtID (0), // print text on graph
TLID (0), // the vertical line
fday(0), // set fday
d1(0), // debugging in output
third(0),
chkdate(0); //set date of vertical line
once cleardebug;
d1 = dayofweek(date);
if (dayofweek(date) = 0) then // if 1st Day of Month is a Sunday draw vertical line the next Monday
fday=2
else if (dayofweek(date) = 6) then // if 1st Day of Month is a Saturday draw vertical line the next Monday
fday=3
else fday = 1; // else 1st Day of Month is 1 draw vertical line same day
if dayofmonth(date) = fday then
begin
print(d1); // print output
chkdate=date;
TLID =
tl_new(chkdate,900,0,chkdate,900,low-100);
tl_SetColor(TLID, white);
tl_setstyle(TLID, 1);
txtID = Text_New(chkdate, Time, low-50, text(fday));
end;
All you need is this:
Code: Select all
if MONTH( date ) <> MONTH( date )[1] then
begin
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2223 times
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2223 times