TLAngle (Function)

image\trumpet2.gif Disclaimer

The TLAngle function returns the angle of a trendline.

Syntax

TLAngle(StartPrice, StartBar, EndPrice, EndBar)

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.

Returns (Double)

A numeric value representing the angle of the specified trendline.

Remarks

To calculate the angle, the function requires that you specify the start and end bars for the trendline as well as the start and end prices. The inputs StartPrice and EndPrice are the start price and end price, respectively, of the trendline. They are usually replaced by values such as Close, High, Low, and so on, or are replaced with numeric series type inputs.

Also, you must offset the Price by its corresponding bar number. For example, if you want 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 with the values Close[10], 10, Close[0], and 0 respectively.

The inputs StartBar and EndBar refer to the number of bars ago (from the current bar) to locate the starting and ending points of the trendline. These inputs must be replaced by positive whole numbers or be replaced with numeric simple type inputs.

The formula used is a simple rise over run calculation to obtain the slope; the formula then takes the arctangent of that slope. In fact, you can obtain the same value as the TLAngle function by taking the ArcTangent of the TLSlope function.

Example

Plot1(TLAngle(High[1],1,High[9],9));

See Also

TLAngleEasy