Trend line from open of 1st open day to next3friday  [SOLVED]

Questions about MultiCharts and user contributed studies.
paul.robillard
Posts: 30
Joined: 22 Mar 2012
Location: Western Europe
Has thanked: 6 times

Trend line from open of 1st open day to next3friday

Postby paul.robillard » 24 Nov 2015

Hi Again,
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;

paul.robillard
Posts: 30
Joined: 22 Mar 2012
Location: Western Europe
Has thanked: 6 times

Re: Trend line from open of 1st open day to next3friday

Postby paul.robillard » 25 Nov 2015

actually i must be overthinking again ...

i tought that

Code: Select all

tl_new(date,900,open,(date+(Next3rdFriday(1))),900,date+(Next3rdFriday(1)(close));
would do it. But it does not :/

Put simply : I want to draw a trend line between the open of today and the close of the next3rdfriday.

User avatar
bensat
Posts: 331
Joined: 04 Oct 2014
Has thanked: 46 times
Been thanked: 104 times

Re: Trend line from open of 1st open day to next3friday  [SOLVED]

Postby bensat » 26 Nov 2015

You must be rich if you know 'the close of the next3rdfriday'. So where to draw the trendline in the future ?? Just project it to the current close and it will be updated till the 'close of the next3rdfriday' was traded.

Good luck.

paul.robillard
Posts: 30
Joined: 22 Mar 2012
Location: Western Europe
Has thanked: 6 times

Re: Trend line from open of 1st open day to next3friday

Postby paul.robillard » 26 Nov 2015

While backtesting we do know the end value of the next 3rd friday ;) But yes i wish i'd know in advance hhh.

I also tought next3rdfriday was limited to future, but thanks to TJ generous input the function can be used for backtesting.

i've been doing research and found something, but i fail to figure out how to code this. So i'm going to repost.


Return to “MultiCharts”