Returns the sine of an angle given in radians.
math.sin takes an angle in radians and returns a value between -1 and 1. A full turn is 2 * math.pi radians.
Convert from degrees first with math.toradians. Sine waves make test signals and cycle indicators.
Syntax
math.sin(angle: simple int/float) -> simple float
math.sin(angle: input int/float) -> input float
math.sin(angle: const int/float) -> const float
math.sin(angle: series int/float) -> series floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| angle | const/ | required | The angle in radians, not degrees. Use math.toradians() to convert from degrees. |
Returns
const/input/simple/series float: the sine, from -1 to 1.
Remarks
math.sin(0)is 0, andmath.sin(math.pi / 2)is 1.
Example
//@version=6
indicator("Sine wave")
plot(math.sin(2 * math.pi * bar_index / 20), "Sine", color = color.blue)
plot(math.cos(2 * math.pi * bar_index / 20), "Cosine", color = color.orange)See also
Runs on Sidechair