Here's my problem today. For backtesting purpose i have been trying to draw trendlines from the OPEN of the 1st open day of the month to the CLOSE of the 2 next3rdfridays.
When taking the problem from the 1st open day pov i get the lines to go from one day to the other allright, but fail to set a CLOSE at the future date :/
When i take it from the next3rdfriday pov that allows me to set a CLOSE[x] in the past, i fail to find how i can figure out the 1st open day of the month based on the next3rdfriday date.
How could i do this ?
Thanks.
Follows is the code i have to draw a lines from 1st open day of month to the 2 next3rdfridays.
Code: Select all
////////////////////////
// FIRST OPEN DAY OF THE MONTH
////////////////////////
if month(date) <> month(Date[1])
then
begin
TLID =
tl_new(tday,900,0,tday,900,low-100);
tl_SetColor(TLID, white);
tl_setstyle(TLID, 1);
txtID = Text_New(tday, Time, low-50, text(d1));
//
/////////////////////////////////////////////////
// trend lines from 1st of month to next 2 expiry fridays
/////////////////////////////////////////////////
//TL to next expiry
TLID1 =
tl_new(tday,900,open,(tday+(Next3rdFriday(1))),1600,close);
tl_SetColor(TLID1, red);
tl_setstyle(TLID1, 1);
//txtID = Text_New(tday, Time, low-50, text(d1));
//TL to 2nd next expiry
TLID2 =
tl_new(tday,900,open,(tday+(Next3rdFriday(2))),1600,close);
tl_SetColor(TLID2, red);
tl_setstyle(TLID2, 1);
//txtID = Text_New(tday, Time, low-50, text(d1));
end;