Returns the tangent of an angle given in radians.
math.tan is math.sin divided by math.cos. It grows without bound as the angle approaches a quarter turn.
The tangent of a slope angle gives the rise per run, so it converts an angle to a gradient.
Syntax
math.tan(angle: simple int/float) -> simple float
math.tan(angle: input int/float) -> input float
math.tan(angle: const int/float) -> const float
math.tan(angle: series int/float) -> series floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| angle | const/ | required | The angle in radians, not degrees. The result is very large near a quarter turn. |
Returns
const/input/simple/series float: the tangent.
Remarks
- Clip the output when plotting, since values near odd multiples of
math.pi/ 2 are huge.
Example
//@version=6
indicator("Tangent")
angle = math.toradians(bar_index % 80)
plot(math.tan(angle), "tan", color = color.red)See also
Runs on Sidechair