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

Re: Plotting a trendline



PureBytes Links

Trading Reference Links

At 8:14 AM -0500 2/12/99, Charles Kaucher wrote:
>
>I have not worked much with drawing objects  in TS.  My request is simple.
>
>I want to plot a horizontal tend line( zero slope) whose endpoint is at the
>current bar and whose endpoint is equal to the value of a moving average on
>the currentbar.
>
>What little I have been able to surmise is that I may have to delete the
>trendline drawn on the  previous bar and draw the new trend line on each bar.
>
>Anyone have sample code?
>
>Secondly, I am trying to have that trendline in the middle of the display
>at all times.  Any ideas on how to do that?



Here is some code that illustrates how to use the drawing commands. You can
get other examples from the Omega code for the "TrendLines-Automatic"
indicator. The commands are largely undocumented, as usual.

The trick is to first draw a new line with the "TL_New" function. This
returns a value which is the ID number of the trendline. You then use this
number in subsequent calls to other functions to change the properties of
the line you just created.

There is some limit to the number of lines you can draw (numbered in the
hundreds) but I foget what it is.

Bob Fulks

----

{Display text and line under text}

if Display then begin
	VLevel = Lowest(L, StOffset - 1) - VOffset * BoxSize;
	Value4 = StOffset/2;
	DLine  = iff(Mod(StOffset, 2) = 0, 2, 0);

	Value1 = Text_New(Date[Value4],Time[Value4], VLevel - BoxSize, Str);
	Value2 = Text_SetStyle(Value1,DLine,2);
	Value2 = Text_SetColor(Value1,Tool_Yellow);

	Value3 = TL_New(Date[StOffset],Time[StOffset], VLevel, Date, Time,
VLevel);
	Value2 = TL_SetColor(Value3, Tool_Yellow);
	Value2 = TL_SetExtLeft(Value3, FALSE);
	Value2 = TL_SetExtRight(Value3, FALSE);
	Value2 = TL_SetAlert(Value3,0);

	Display = FALSE;
	Plot1(BPoint,"Buy");
end;