TL_New (Reserved Word)
This reserved word adds a trendline with the specified starting and ending points to a price chart. It returns a numeric expression corresponding to the ID number of the trendline added to the chart.
Value1 = TL_New(iBarDate, iBarTime, iPrice, eBarDate, eBarTime, ePrice)
iBarDate, iBarTime, and iPrice are numeric expressions corresponding to the date, time, and price, respectively, of the starting point; eBarDate, eBarTime, and ePrice are numeric expressions corresponding to the date, time, and price, respectively, of the end point of the trendline. Dates use YYMMDD or YYYMMDD format (three digits are used to express the year 2000 and later), and times use 24-hour format, HHMM.
Value1 is any numeric variable or array, and holds the ID number for the new trendline.
Remarks
When the reserved word performs its operation successfully, the reserved word returns the ID number for the new trendline. When the reserved word cannot perform its operation, it returns an error code. For a list of error codes, see EasyLanguage Drawing Object Error Codes.
When any drawing object error occurs, no additional operations will be performed on any drawing objects by the trading strategy, analysis technique, or function that generated the error.
Be aware that a minimum of two different points are needed in order to draw any trendline on a price chart, and this is the information that you need to provide to the TL_New reserved word to draw a trendline on the price chart from a trading strategy, analysis technique, or function.
Trendlines are added to the chart using the default properties set in the charting application. As you will see, you can change any of these properties using other trendline related reserved words. If you want to modify a trendline in any way, it is very important that you capture and keep the number; the ID number is the only way of referencing a specific trendline.
Example
The following creates a trendline that begins a 9:30am on January 7, 1999 at a value of 45, and ends at 4:00pm on January 25, 1999 at a value of 37.250:
Value1 = TL_New(990107, 0930, 45, 990125, 1600, 37.250) ;
Additional Example
The following statements create horizontal trendline at the session's opening price. The horizontal line begins at the first bar of the session and extends to the last bar of the session.
Variable: ID(-1);
If Time = SessionFirstBarTime(1, 1) then
ID = TL_New(Date, Time, Open, Date, SessionEndTime(1, 1), Open);