TLSlope (Function)
The TLSlope function returns the slope of a trendline.
Syntax
TLSlope(StartPrice, StartBar, EndPrice, EndBar)
Returns (Double)
A numeric value containing the slope of the specified trendline.
Parameters
Name |
Type |
Description |
StartPrice |
Numeric |
Sets the price of the trendline start point. |
StartBar |
Numeric |
Sets the bar number (bars ago) of the trendline start point. |
EndPrice |
Numeric |
Sets the price of the trendline end point. |
EndBar |
Numeric |
Sets the bar number (bars ago) of the trendline end point. |
Remarks
To calculate the angle the function will need the bar numbers and prices for the two endpoints of the trendline. The inputs EndPrice and StartPrice are the starting point and ending points of the trendline, respectively. They are usually replaced by values such as Close, High, Low, and so on, or can be replaced with numeric series inputs.
You must offset the price by its corresponding bar number. For example, if you wanted the trendline angle for a line drawn from the Close of ten bars ago to the Close of the current bar, replace the inputs StartPrice, StartBar, EndPrice, and EndBar would be replaced with the values Close[10], 10, Close[0], and 0 respectively.
The inputs EndBar and StartBar refer to the number of bars ago (from the current bar) of the starting and ending points of the trendline. These inputs can be replaced by whole numbers or with numeric simple type inputs that return positive whole numbers when using their default values. The formula used is a simple rise over run calculation.
Example
Plot1(TLSlope(High[1],1,High[9],9));