TL_GetNext (Reserved Word)
EasyLanguage enables you to search for trendlines based on how they were created. The charting application stores the chronological order of all trendlines added to a chart, and this information is made available to EasyLanguage. This reserved word returns the ID number of the trendline on the price chart added immediately after the trendline specified. You can use this reserved word together with the reserved word TL_GetFirst to traverse all the trendlines in a price chart.
Value1 = TL_GetNext(TL_ID, Num)
Value1 is any numeric variable or array that holds the ID number of the desired trendline. Num is a numeric expression representing the origin type of the trendline. Refer to EasyLanguage Trendline and Text Object Parameters for a list of possible values.
Remarks
When the reserved word performs its operation successfully, the identification number for the trendline is returned. When a reserved word cannot perform its operation, it returns an error code. For a list of error codes, see EasyLanguage Drawing Object Error Codes.
It is important to remember that if an invalid ID number is used, the reserved word will return a value of -2 and no additional operations will be performed on any trendlines by the trading strategy, analysis technique, or function that generated the error.
Example
To obtain the identification number returned by the reserved word, you need to assign the reserved word to a numeric variable. The following returns the identification number of the trendline drawn on the chart after the trendline referenced by Value99, and by the trendline drawing object.
Value1 = TL_GetNext(Value99, 2) ;
Additional Example
The following statements set the color of all trendlines in the chart to yellow:
Value1 = TL_GetFirst(3);
While Value1 <> -2
Begin
Value2 = TL_SetColor(Value1, Yellow);
Value1 = TL_GetNext(Value1, 3);
End;
In the above example, we obtain the ID number for the first trendline drawn on the chart. Then, we set its color to yellow. We then obtain the ID number of the next trendline and set that to yellow. This loop continues until TL_GetNext returns -2 indicating that there are no more trendlines on the chart. Keep in mind that once the trading strategy, analysis technique, or function returns -2, it cannot draw any more trendline on the chart. In this situation, you may want to use one trading strategy, analysis technique, or function to draw the trendlines, and another to change their color.