EasyLanguage Object Reference
Draws a trendline on a chart through two points. The points may be time-based (DTPoint) or bar number-based (BNPoint). Appearance may altered and an alert enabled using appropriate properties. Trendlines are often used to track market direction and identify breakouts. To use this in an analysis technique, be sure that it is setup as described in About Drawing Objects.
A trendline may be created and drawn from the Close of 20 bars ago to the Close of the last bar on the chart as follows:
using elsystem.drawingobjects; vars: TrendLine myTrendLine1(null), BNPoint myBNPoint1(null), BNPoint myBNPoint2(null); If LastBarOnChart then once begin
myBNPoint1 = BNPoint.Create(barnumber-20,close[20]); // create a starting point 20 bars to the left myBNPoint2 = BNPoint.Create(barnumber,close); // create an ending point at current bar myTrendLine1 = TrendLine.create(myBNPoint1,myBNPoint2); // create an instance of a trendline object based on two bar number points myTrendLine1.Persist = True; // trendline remains on screen after tick refreshes myTrendLine1.Style = 2; // trendline will be drawn as a dotted line DrawingObjects.Add(myTrendLine1); // plot the trendline on the chart end;
Note that the Persist property in the above example, as well as additional properties, methods, and events not listed below, are inherited from DrawingObject.
You can also create the above trendline without needing to define BNPoint objects by directly specifying the BNPoint values when creating the trendline instance)
myTrendLine1 = TrendLine.Create(BNPoint.Create(barnumber-20,close[20]),BNPoint.Create(barnumber,close));
Namespace: elsystem.drawingobjects