[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: trendline channel coding question



PureBytes Links

Trading Reference Links

>is it possible to draw a trendline on the charts from
>low to high through some bars and then measure the
>distance from this line to the highest high bar and
>lowest low bar within the trendline length?
>after that, take the greater distance (to the high or
>low9 and create a trendline channel with the two
>parallel channels?

I assume you're doing this in code, not drawing stuff manually on a
chart.

First you would use TL_New to create a trendline where you want.
TL_New returns a trendline ID number.  At the highest high bar and
lowest low bar, call TL_GetValue (using the trendline ID number you
got from TL_New) to get the value of the trendline on those bars.
Once you have the trendline value, you can calculate the distance.

To create a channel, you would use this distance to create two new
trendlines above and below the original one (using TL_New), offset
by this distance from the endpoints of the original trendline.

-Alex