> ## Documentation Index
> Fetch the complete documentation index at: https://gocharting.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# math functions

> Reference for the 24 functions (106 entries with overloads) of the math namespace: math.abs, math.acos, math.asin, math.atan and 20 more, each with its definition and an example.

> [!NOTE]
>
> Language version: 2 · Reference version: 2.7 · Date: 2026-10-25 · Compiler build: df7b3b14 · Namespace: math · Entries: 107

## `math` (library)

**Definition**

Twenty-three arithmetic and trigonometric functions, and four constants: `math.pi`, `math.e`, `math.phi` and `math.rphi`.

`math.log` is the natural logarithm (base e); `math.log10` is the base-10 logarithm.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math Library Example", overlay=false)
// Percentage change, rounded to 2 decimals and capped at +/-10
pct = (close - close[1]) / close[1] * 100
capped = math.max(-10, math.min(10, math.round(pct, 2)))
plot(capped, title="Change % (capped)", color=color.blue)
```

## `math.abs` (function, overload 1)

**Definition**

The absolute value of `number`: its magnitude, with the sign removed.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.abs(const int number) → const int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `const int` | yes | The number to use in the calculation. |

**Returns**

`const int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.abs Example", overlay=false)
change = math.abs(close - open)
plot(change, title="Candle Body Size", color=color.blue)
```

## `math.abs` (function, overload 2)

**Definition**

The absolute value of `number`: its magnitude, with the sign removed.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.abs(input int number) → input int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `input int` | yes | The number to use in the calculation. |

**Returns**

`input int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.abs Example", overlay=false)
change = math.abs(close - open)
plot(change, title="Candle Body Size", color=color.blue)
```

## `math.abs` (function, overload 3)

**Definition**

The absolute value of `number`: its magnitude, with the sign removed.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.abs(simple int number) → simple int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `simple int` | yes | The number to use in the calculation. |

**Returns**

`simple int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.abs Example", overlay=false)
change = math.abs(close - open)
plot(change, title="Candle Body Size", color=color.blue)
```

## `math.abs` (function, overload 4)

**Definition**

The absolute value of `number`: its magnitude, with the sign removed.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.abs(series int number) → series int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `series int` | yes | The number to use in the calculation. |

**Returns**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.abs Example", overlay=false)
change = math.abs(close - open)
plot(change, title="Candle Body Size", color=color.blue)
```

## `math.abs` (function, overload 5)

**Definition**

The absolute value of `number`: its magnitude, with the sign removed.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.abs(const float number) → const float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `const float` | yes | The number to use in the calculation. |

**Returns**

`const float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.abs Example", overlay=false)
change = math.abs(close - open)
plot(change, title="Candle Body Size", color=color.blue)
```

## `math.abs` (function, overload 6)

**Definition**

The absolute value of `number`: its magnitude, with the sign removed.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.abs(input float number) → input float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `input float` | yes | The number to use in the calculation. |

**Returns**

`input float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.abs Example", overlay=false)
change = math.abs(close - open)
plot(change, title="Candle Body Size", color=color.blue)
```

## `math.abs` (function, overload 7)

**Definition**

The absolute value of `number`: its magnitude, with the sign removed.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.abs(simple float number) → simple float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `simple float` | yes | The number to use in the calculation. |

**Returns**

`simple float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.abs Example", overlay=false)
change = math.abs(close - open)
plot(change, title="Candle Body Size", color=color.blue)
```

## `math.abs` (function, overload 8)

**Definition**

The absolute value of `number`: its magnitude, with the sign removed.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.abs(series float number) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `series float` | yes | The number to use in the calculation. |

**Returns**

`series float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.abs Example", overlay=false)
change = math.abs(close - open)
plot(change, title="Candle Body Size", color=color.blue)
```

## `math.acos` (function, overload 1)

**Definition**

The arccosine of `angle`, in radians.

It is defined for a value from -1 to 1.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.acos(const float angle) → const float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `const float` | yes | The value, in radians, to use in the calculation. |

**Returns**

`const float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.acos Example", overlay=false)
angle = math.acos(0.5)
plot(math.todegrees(angle), title="acos(0.5) in Degrees (60)", color=color.blue)
```

## `math.acos` (function, overload 2)

**Definition**

The arccosine of `angle`, in radians.

It is defined for a value from -1 to 1.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.acos(input float angle) → input float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `input float` | yes | The value, in radians, to use in the calculation. |

**Returns**

`input float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.acos Example", overlay=false)
angle = math.acos(0.5)
plot(math.todegrees(angle), title="acos(0.5) in Degrees (60)", color=color.blue)
```

## `math.acos` (function, overload 3)

**Definition**

The arccosine of `angle`, in radians.

It is defined for a value from -1 to 1.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.acos(simple float angle) → simple float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `simple float` | yes | The value, in radians, to use in the calculation. |

**Returns**

`simple float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.acos Example", overlay=false)
angle = math.acos(0.5)
plot(math.todegrees(angle), title="acos(0.5) in Degrees (60)", color=color.blue)
```

## `math.acos` (function, overload 4)

**Definition**

The arccosine of `angle`, in radians.

It is defined for a value from -1 to 1.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.acos(series float angle) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `series float` | yes | The value, in radians, to use in the calculation. |

**Returns**

`series float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.acos Example", overlay=false)
angle = math.acos(0.5)
plot(math.todegrees(angle), title="acos(0.5) in Degrees (60)", color=color.blue)
```

## `math.asin` (function, overload 1)

**Definition**

The arcsine of `angle`, in radians.

It is defined for a value from -1 to 1.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.asin(const float angle) → const float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `const float` | yes | The value, in radians, to use in the calculation. |

**Returns**

`const float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.asin Example", overlay=false)
angle = math.asin(0.5)
plot(math.todegrees(angle), title="asin(0.5) in Degrees (30)", color=color.blue)
```

## `math.asin` (function, overload 2)

**Definition**

The arcsine of `angle`, in radians.

It is defined for a value from -1 to 1.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.asin(input float angle) → input float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `input float` | yes | The value, in radians, to use in the calculation. |

**Returns**

`input float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.asin Example", overlay=false)
angle = math.asin(0.5)
plot(math.todegrees(angle), title="asin(0.5) in Degrees (30)", color=color.blue)
```

## `math.asin` (function, overload 3)

**Definition**

The arcsine of `angle`, in radians.

It is defined for a value from -1 to 1.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.asin(simple float angle) → simple float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `simple float` | yes | The value, in radians, to use in the calculation. |

**Returns**

`simple float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.asin Example", overlay=false)
angle = math.asin(0.5)
plot(math.todegrees(angle), title="asin(0.5) in Degrees (30)", color=color.blue)
```

## `math.asin` (function, overload 4)

**Definition**

The arcsine of `angle`, in radians.

It is defined for a value from -1 to 1.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.asin(series float angle) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `series float` | yes | The value, in radians, to use in the calculation. |

**Returns**

`series float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.asin Example", overlay=false)
angle = math.asin(0.5)
plot(math.todegrees(angle), title="asin(0.5) in Degrees (30)", color=color.blue)
```

## `math.atan` (function, overload 1)

**Definition**

The arctangent of `angle`, in radians.

It is defined for every number.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.atan(const float angle) → const float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `const float` | yes | The value, in radians, to use in the calculation. |

**Returns**

`const float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.atan Example", overlay=false)
// Slope of a 10-bar change, as an angle
slopeAngle = math.todegrees(math.atan((close - close[10]) / 10))
plot(slopeAngle, title="Slope Angle", color=color.blue)
```

## `math.atan` (function, overload 2)

**Definition**

The arctangent of `angle`, in radians.

It is defined for every number.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.atan(input float angle) → input float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `input float` | yes | The value, in radians, to use in the calculation. |

**Returns**

`input float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.atan Example", overlay=false)
// Slope of a 10-bar change, as an angle
slopeAngle = math.todegrees(math.atan((close - close[10]) / 10))
plot(slopeAngle, title="Slope Angle", color=color.blue)
```

## `math.atan` (function, overload 3)

**Definition**

The arctangent of `angle`, in radians.

It is defined for every number.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.atan(simple float angle) → simple float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `simple float` | yes | The value, in radians, to use in the calculation. |

**Returns**

`simple float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.atan Example", overlay=false)
// Slope of a 10-bar change, as an angle
slopeAngle = math.todegrees(math.atan((close - close[10]) / 10))
plot(slopeAngle, title="Slope Angle", color=color.blue)
```

## `math.atan` (function, overload 4)

**Definition**

The arctangent of `angle`, in radians.

It is defined for every number.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.atan(series float angle) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `series float` | yes | The value, in radians, to use in the calculation. |

**Returns**

`series float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.atan Example", overlay=false)
// Slope of a 10-bar change, as an angle
slopeAngle = math.todegrees(math.atan((close - close[10]) / 10))
plot(slopeAngle, title="Slope Angle", color=color.blue)
```

## `math.avg` (function, overload 1)

**Definition**

The arithmetic mean of the numbers you pass: their sum divided by how many there are.

It averages the arguments in the one call. It does not average a value across bars, and it takes no length argument.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.avg(const float number0, number1, ...) → const float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number0, number1, ...` | `const float` | yes | A sequence of numbers to use in the calculation. |

**Returns**

`const float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Math Avg Example", overlay=true)
val1 = close
val2 = open
avgValue = math.avg(val1, val2)
plot(avgValue, color=color.blue, title="Average")
```

## `math.avg` (function, overload 2)

**Definition**

The arithmetic mean of the numbers you pass: their sum divided by how many there are.

It averages the arguments in the one call. It does not average a value across bars, and it takes no length argument.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.avg(input float number0, number1, ...) → input float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number0, number1, ...` | `input float` | yes | A sequence of numbers to use in the calculation. |

**Returns**

`input float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Math Avg Example", overlay=true)
val1 = close
val2 = open
avgValue = math.avg(val1, val2)
plot(avgValue, color=color.blue, title="Average")
```

## `math.avg` (function, overload 3)

**Definition**

The arithmetic mean of the numbers you pass: their sum divided by how many there are.

It averages the arguments in the one call. It does not average a value across bars, and it takes no length argument.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.avg(simple float number0, number1, ...) → simple float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number0, number1, ...` | `simple float` | yes | A sequence of numbers to use in the calculation. |

**Returns**

`simple float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Math Avg Example", overlay=true)
val1 = close
val2 = open
avgValue = math.avg(val1, val2)
plot(avgValue, color=color.blue, title="Average")
```

## `math.avg` (function, overload 4)

**Definition**

The arithmetic mean of the numbers you pass: their sum divided by how many there are.

It averages the arguments in the one call. It does not average a value across bars, and it takes no length argument.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.avg(series float number0, number1, ...) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number0, number1, ...` | `series float` | yes | A sequence of numbers to use in the calculation. |

**Returns**

`series float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Math Avg Example", overlay=true)
val1 = close
val2 = open
avgValue = math.avg(val1, val2)
plot(avgValue, color=color.blue, title="Average")
```

## `math.ceil` (function, overload 1)

**Definition**

The smallest whole number that is not less than `number`.

The result is an int, not a float.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.ceil(const float number) → const int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `const float` | yes | The number to use in the calculation. |

**Returns**

`const int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.ceil Example", overlay=false)
roundedUp = math.ceil(close)
plot(roundedUp, title="Close Rounded Up", color=color.blue)
```

## `math.ceil` (function, overload 2)

**Definition**

The smallest whole number that is not less than `number`.

The result is an int, not a float.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.ceil(input float number) → input int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `input float` | yes | The number to use in the calculation. |

**Returns**

`input int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.ceil Example", overlay=false)
roundedUp = math.ceil(close)
plot(roundedUp, title="Close Rounded Up", color=color.blue)
```

## `math.ceil` (function, overload 3)

**Definition**

The smallest whole number that is not less than `number`.

The result is an int, not a float.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.ceil(simple float number) → simple int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `simple float` | yes | The number to use in the calculation. |

**Returns**

`simple int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.ceil Example", overlay=false)
roundedUp = math.ceil(close)
plot(roundedUp, title="Close Rounded Up", color=color.blue)
```

## `math.ceil` (function, overload 4)

**Definition**

The smallest whole number that is not less than `number`.

The result is an int, not a float.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.ceil(series float number) → series int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `series float` | yes | The number to use in the calculation. |

**Returns**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.ceil Example", overlay=false)
roundedUp = math.ceil(close)
plot(roundedUp, title="Close Rounded Up", color=color.blue)
```

## `math.cos` (function, overload 1)

**Definition**

The cosine of `angle`, where the angle is in radians.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.cos(const float angle) → const float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `const float` | yes | Angle, in radians. |

**Returns**

`const float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.cos Example", overlay=false)
wave = math.cos(bar_index * math.pi / 10)
plot(wave, title="Cosine Wave", color=color.blue)
```

## `math.cos` (function, overload 2)

**Definition**

The cosine of `angle`, where the angle is in radians.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.cos(input float angle) → input float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `input float` | yes | Angle, in radians. |

**Returns**

`input float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.cos Example", overlay=false)
wave = math.cos(bar_index * math.pi / 10)
plot(wave, title="Cosine Wave", color=color.blue)
```

## `math.cos` (function, overload 3)

**Definition**

The cosine of `angle`, where the angle is in radians.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.cos(simple float angle) → simple float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `simple float` | yes | Angle, in radians. |

**Returns**

`simple float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.cos Example", overlay=false)
wave = math.cos(bar_index * math.pi / 10)
plot(wave, title="Cosine Wave", color=color.blue)
```

## `math.cos` (function, overload 4)

**Definition**

The cosine of `angle`, where the angle is in radians.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.cos(series float angle) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `series float` | yes | Angle, in radians. |

**Returns**

`series float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.cos Example", overlay=false)
wave = math.cos(bar_index * math.pi / 10)
plot(wave, title="Cosine Wave", color=color.blue)
```

## `math.exp` (function, overload 1)

**Definition**

Euler's number raised to the power of `number`.

It is the inverse of math.log.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.exp(const float number) → const float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `const float` | yes | The number to use in the calculation. |

**Returns**

`const float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.exp Example", overlay=false)
growth = math.exp(0.01 * (bar_index % 100))
plot(growth, title="Exponential Growth", color=color.blue)
```

## `math.exp` (function, overload 2)

**Definition**

Euler's number raised to the power of `number`.

It is the inverse of math.log.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.exp(input float number) → input float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `input float` | yes | The number to use in the calculation. |

**Returns**

`input float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.exp Example", overlay=false)
growth = math.exp(0.01 * (bar_index % 100))
plot(growth, title="Exponential Growth", color=color.blue)
```

## `math.exp` (function, overload 3)

**Definition**

Euler's number raised to the power of `number`.

It is the inverse of math.log.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.exp(simple float number) → simple float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `simple float` | yes | The number to use in the calculation. |

**Returns**

`simple float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.exp Example", overlay=false)
growth = math.exp(0.01 * (bar_index % 100))
plot(growth, title="Exponential Growth", color=color.blue)
```

## `math.exp` (function, overload 4)

**Definition**

Euler's number raised to the power of `number`.

It is the inverse of math.log.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.exp(series float number) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `series float` | yes | The number to use in the calculation. |

**Returns**

`series float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.exp Example", overlay=false)
growth = math.exp(0.01 * (bar_index % 100))
plot(growth, title="Exponential Growth", color=color.blue)
```

## `math.floor` (function, overload 1)

**Definition**

The largest whole number that is not greater than `number`.

The result is an int, not a float.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.floor(const float number) → const int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `const float` | yes | The number to use in the calculation. |

**Returns**

`const int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.floor Example", overlay=false)
roundedDown = math.floor(close)
plot(roundedDown, title="Close Rounded Down", color=color.blue)
```

## `math.floor` (function, overload 2)

**Definition**

The largest whole number that is not greater than `number`.

The result is an int, not a float.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.floor(input float number) → input int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `input float` | yes | The number to use in the calculation. |

**Returns**

`input int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.floor Example", overlay=false)
roundedDown = math.floor(close)
plot(roundedDown, title="Close Rounded Down", color=color.blue)
```

## `math.floor` (function, overload 3)

**Definition**

The largest whole number that is not greater than `number`.

The result is an int, not a float.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.floor(simple float number) → simple int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `simple float` | yes | The number to use in the calculation. |

**Returns**

`simple int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.floor Example", overlay=false)
roundedDown = math.floor(close)
plot(roundedDown, title="Close Rounded Down", color=color.blue)
```

## `math.floor` (function, overload 4)

**Definition**

The largest whole number that is not greater than `number`.

The result is an int, not a float.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.floor(series float number) → series int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `series float` | yes | The number to use in the calculation. |

**Returns**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.floor Example", overlay=false)
roundedDown = math.floor(close)
plot(roundedDown, title="Close Rounded Down", color=color.blue)
```

## `math.log` (function, overload 1)

**Definition**

The natural logarithm of `number`: its logarithm to base e.

It is defined for a number greater than zero. For base 10, use `math.log10`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.log(const float number) → const float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `const float` | yes | The number to use in the calculation. |

**Returns**

`const float`

**Notes**

* The compiler also accepts `math.log10`. `math.log2` is rejected.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.log Example", overlay=false)
// Log return from the previous bar
logReturn = math.log(close / close[1])
plot(logReturn, title="Log Return", color=color.blue)
```

## `math.log` (function, overload 2)

**Definition**

The natural logarithm of `number`: its logarithm to base e.

It is defined for a number greater than zero. For base 10, use `math.log10`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.log(input float number) → input float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `input float` | yes | The number to use in the calculation. |

**Returns**

`input float`

**Notes**

* The compiler also accepts `math.log10`. `math.log2` is rejected.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.log Example", overlay=false)
// Log return from the previous bar
logReturn = math.log(close / close[1])
plot(logReturn, title="Log Return", color=color.blue)
```

## `math.log` (function, overload 3)

**Definition**

The natural logarithm of `number`: its logarithm to base e.

It is defined for a number greater than zero. For base 10, use `math.log10`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.log(simple float number) → simple float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `simple float` | yes | The number to use in the calculation. |

**Returns**

`simple float`

**Notes**

* The compiler also accepts `math.log10`. `math.log2` is rejected.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.log Example", overlay=false)
// Log return from the previous bar
logReturn = math.log(close / close[1])
plot(logReturn, title="Log Return", color=color.blue)
```

## `math.log` (function, overload 4)

**Definition**

The natural logarithm of `number`: its logarithm to base e.

It is defined for a number greater than zero. For base 10, use `math.log10`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.log(series float number) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `series float` | yes | The number to use in the calculation. |

**Returns**

`series float`

**Notes**

* The compiler also accepts `math.log10`. `math.log2` is rejected.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.log Example", overlay=false)
// Log return from the previous bar
logReturn = math.log(close / close[1])
plot(logReturn, title="Log Return", color=color.blue)
```

## `math.log10` (function, overload 1)

**Definition**

The base-10 logarithm of `number`.

It is defined for a number greater than zero; otherwise the result is `na`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.log10(const float number) → const float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `const float` | yes | The number to use in the calculation. |

**Returns**

`const float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.log10 Example", overlay=false)
plot(math.log10(close), title="Log10 Close", color=color.blue)
```

## `math.log10` (function, overload 2)

**Definition**

The base-10 logarithm of `number`.

It is defined for a number greater than zero; otherwise the result is `na`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.log10(input float number) → input float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `input float` | yes | The number to use in the calculation. |

**Returns**

`input float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.log10 Example", overlay=false)
plot(math.log10(close), title="Log10 Close", color=color.blue)
```

## `math.log10` (function, overload 3)

**Definition**

The base-10 logarithm of `number`.

It is defined for a number greater than zero; otherwise the result is `na`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.log10(simple float number) → simple float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `simple float` | yes | The number to use in the calculation. |

**Returns**

`simple float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.log10 Example", overlay=false)
plot(math.log10(close), title="Log10 Close", color=color.blue)
```

## `math.log10` (function, overload 4)

**Definition**

The base-10 logarithm of `number`.

It is defined for a number greater than zero; otherwise the result is `na`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.log10(series float number) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `series float` | yes | The number to use in the calculation. |

**Returns**

`series float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.log10 Example", overlay=false)
plot(math.log10(close), title="Log10 Close", color=color.blue)
```

## `math.max` (function, overload 1)

**Definition**

The largest of the numbers you pass.

It compares the arguments in the one call. It does not look back over bars, and it takes no length argument.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.max(const int number0, number1, ...) → const int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number0, number1, ...` | `const int` | yes | A list of numbers to perform the calculation on. |

**Returns**

`const int`

The greatest of the given numbers.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.max", overlay=true)
plot(math.max(open,close))
```

## `math.max` (function, overload 2)

**Definition**

The largest of the numbers you pass.

It compares the arguments in the one call. It does not look back over bars, and it takes no length argument.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.max(input int number0, number1, ...) → input int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number0, number1, ...` | `input int` | yes | A list of numbers to perform the calculation on. |

**Returns**

`input int`

The greatest of the given numbers.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.max", overlay=true)
plot(math.max(open,close))
```

## `math.max` (function, overload 3)

**Definition**

The largest of the numbers you pass.

It compares the arguments in the one call. It does not look back over bars, and it takes no length argument.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.max(simple int number0, number1, ...) → simple int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number0, number1, ...` | `simple int` | yes | A list of numbers to perform the calculation on. |

**Returns**

`simple int`

The greatest of the given numbers.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.max", overlay=true)
plot(math.max(open,close))
```

## `math.max` (function, overload 4)

**Definition**

The largest of the numbers you pass.

It compares the arguments in the one call. It does not look back over bars, and it takes no length argument.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.max(series int number0, number1, ...) → series int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number0, number1, ...` | `series int` | yes | A list of numbers to perform the calculation on. |

**Returns**

`series int`

The greatest of the given numbers.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.max", overlay=true)
plot(math.max(open,close))
```

## `math.max` (function, overload 5)

**Definition**

The largest of the numbers you pass.

It compares the arguments in the one call. It does not look back over bars, and it takes no length argument.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.max(const float number0, number1, ...) → const float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number0, number1, ...` | `const float` | yes | A list of numbers to perform the calculation on. |

**Returns**

`const float`

The greatest of the given numbers.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.max", overlay=true)
plot(math.max(open,close))
```

## `math.max` (function, overload 6)

**Definition**

The largest of the numbers you pass.

It compares the arguments in the one call. It does not look back over bars, and it takes no length argument.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.max(input float number0, number1, ...) → input float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number0, number1, ...` | `input float` | yes | A list of numbers to perform the calculation on. |

**Returns**

`input float`

The greatest of the given numbers.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.max", overlay=true)
plot(math.max(open,close))
```

## `math.max` (function, overload 7)

**Definition**

The largest of the numbers you pass.

It compares the arguments in the one call. It does not look back over bars, and it takes no length argument.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.max(simple float number0, number1, ...) → simple float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number0, number1, ...` | `simple float` | yes | A list of numbers to perform the calculation on. |

**Returns**

`simple float`

The greatest of the given numbers.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.max", overlay=true)
plot(math.max(open,close))
```

## `math.max` (function, overload 8)

**Definition**

The largest of the numbers you pass.

It compares the arguments in the one call. It does not look back over bars, and it takes no length argument.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.max(series float number0, number1, ...) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number0, number1, ...` | `series float` | yes | A list of numbers to perform the calculation on. |

**Returns**

`series float`

The greatest of the given numbers.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.max", overlay=true)
plot(math.max(open,close))
```

## `math.min` (function, overload 1)

**Definition**

The smallest of the numbers you pass.

It compares the arguments in the one call. It does not look back over bars, and it takes no length argument.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.min(const int number0, number1, ...) → const int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number0, number1, ...` | `const int` | yes | A list of numbers to perform the calculation on. |

**Returns**

`const int`

The smallest of the given numbers.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.min", overlay=true)
plot(math.min(open,close))
```

## `math.min` (function, overload 2)

**Definition**

The smallest of the numbers you pass.

It compares the arguments in the one call. It does not look back over bars, and it takes no length argument.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.min(input int number0, number1, ...) → input int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number0, number1, ...` | `input int` | yes | A list of numbers to perform the calculation on. |

**Returns**

`input int`

The smallest of the given numbers.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.min", overlay=true)
plot(math.min(open,close))
```

## `math.min` (function, overload 3)

**Definition**

The smallest of the numbers you pass.

It compares the arguments in the one call. It does not look back over bars, and it takes no length argument.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.min(simple int number0, number1, ...) → simple int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number0, number1, ...` | `simple int` | yes | A list of numbers to perform the calculation on. |

**Returns**

`simple int`

The smallest of the given numbers.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.min", overlay=true)
plot(math.min(open,close))
```

## `math.min` (function, overload 4)

**Definition**

The smallest of the numbers you pass.

It compares the arguments in the one call. It does not look back over bars, and it takes no length argument.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.min(series int number0, number1, ...) → series int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number0, number1, ...` | `series int` | yes | A list of numbers to perform the calculation on. |

**Returns**

`series int`

The smallest of the given numbers.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.min", overlay=true)
plot(math.min(open,close))
```

## `math.min` (function, overload 5)

**Definition**

The smallest of the numbers you pass.

It compares the arguments in the one call. It does not look back over bars, and it takes no length argument.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.min(const float number0, number1, ...) → const float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number0, number1, ...` | `const float` | yes | A list of numbers to perform the calculation on. |

**Returns**

`const float`

The smallest of the given numbers.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.min", overlay=true)
plot(math.min(open,close))
```

## `math.min` (function, overload 6)

**Definition**

The smallest of the numbers you pass.

It compares the arguments in the one call. It does not look back over bars, and it takes no length argument.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.min(input float number0, number1, ...) → input float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number0, number1, ...` | `input float` | yes | A list of numbers to perform the calculation on. |

**Returns**

`input float`

The smallest of the given numbers.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.min", overlay=true)
plot(math.min(open,close))
```

## `math.min` (function, overload 7)

**Definition**

The smallest of the numbers you pass.

It compares the arguments in the one call. It does not look back over bars, and it takes no length argument.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.min(simple float number0, number1, ...) → simple float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number0, number1, ...` | `simple float` | yes | A list of numbers to perform the calculation on. |

**Returns**

`simple float`

The smallest of the given numbers.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.min", overlay=true)
plot(math.min(open,close))
```

## `math.min` (function, overload 8)

**Definition**

The smallest of the numbers you pass.

It compares the arguments in the one call. It does not look back over bars, and it takes no length argument.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.min(series float number0, number1, ...) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number0, number1, ...` | `series float` | yes | A list of numbers to perform the calculation on. |

**Returns**

`series float`

The smallest of the given numbers.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.min", overlay=true)
plot(math.min(open,close))
```

## `math.pow` (function, overload 1)

**Definition**

`base` raised to the power of `exponent`.

The language has no exponentiation operator: a token for one exists in the lexer but no rule reaches it, so source containing `^` does not parse. This function is how you raise a number to a power.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.pow(const float base, const float exponent) → const float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `base` | `const float` | yes | Specify the base to use. |
| `exponent` | `const float` | yes | Specifies the exponent. |

**Returns**

`const float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.pow Example", overlay=false)
squared = math.pow(close - open, 2)
plot(squared, title="Squared Body", color=color.blue)
```

## `math.pow` (function, overload 2)

**Definition**

`base` raised to the power of `exponent`.

The language has no exponentiation operator: a token for one exists in the lexer but no rule reaches it, so source containing `^` does not parse. This function is how you raise a number to a power.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.pow(input float base, input float exponent) → input float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `base` | `input float` | yes | Specify the base to use. |
| `exponent` | `input float` | yes | Specifies the exponent. |

**Returns**

`input float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.pow Example", overlay=false)
squared = math.pow(close - open, 2)
plot(squared, title="Squared Body", color=color.blue)
```

## `math.pow` (function, overload 3)

**Definition**

`base` raised to the power of `exponent`.

The language has no exponentiation operator: a token for one exists in the lexer but no rule reaches it, so source containing `^` does not parse. This function is how you raise a number to a power.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.pow(simple float base, simple float exponent) → simple float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `base` | `simple float` | yes | Specify the base to use. |
| `exponent` | `simple float` | yes | Specifies the exponent. |

**Returns**

`simple float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.pow Example", overlay=false)
squared = math.pow(close - open, 2)
plot(squared, title="Squared Body", color=color.blue)
```

## `math.pow` (function, overload 4)

**Definition**

`base` raised to the power of `exponent`.

The language has no exponentiation operator: a token for one exists in the lexer but no rule reaches it, so source containing `^` does not parse. This function is how you raise a number to a power.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.pow(series float base, series float exponent) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `base` | `series float` | yes | Specify the base to use. |
| `exponent` | `series float` | yes | Specifies the exponent. |

**Returns**

`series float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.pow Example", overlay=false)
squared = math.pow(close - open, 2)
plot(squared, title="Squared Body", color=color.blue)
```

## `math.random` (function)

**Definition**

Gives your script a random float, bounded below by `min` and above by `max`.

Both bounds are optional. There is no seed argument, so a result cannot be reproduced. Keep the value out of anything a reader is meant to compare between runs.

It has a single form, series. A series value is refused wherever a narrower form is required, so this result cannot fill a const, input or simple argument - a script's title, for instance.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.random(series float min, series float max) → series float
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `min` | `series float` | no | The lower bound of the range of random values. The value is included in the range. The default is 0. | `0` |
| `max` | `series float` | no | The upper bound of the range of random values. The value is not included in the range. The default is 1. | `1` |

**Returns**

`series float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.random Example", overlay=false)
noise = math.random(-1, 1)
plot(noise, title="Random Value", color=color.gray)
```

## `math.round` (function, overload 1)

**Definition**

Rounds `number` to the nearest whole number and returns an int.

Pass a `precision` as well and the function keeps decimal places instead: the result is then a float, not an int. That change of return type is the practical difference between the two forms, so pick the form by what you need back - an int to count with, a float to plot.

In the series form the precision is itself series, so how many places you keep can differ from bar to bar.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.round(const float number) → const int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `const float` | yes | The value to be rounded. |

**Returns**

`const int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.round Example", overlay=false)
rounded = math.round(close, 2)
plot(rounded, title="Close to 2 Decimals", color=color.blue)
```

## `math.round` (function, overload 2)

**Definition**

Rounds `number` to the nearest whole number and returns an int.

Pass a `precision` as well and the function keeps decimal places instead: the result is then a float, not an int. That change of return type is the practical difference between the two forms, so pick the form by what you need back - an int to count with, a float to plot.

In the series form the precision is itself series, so how many places you keep can differ from bar to bar.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.round(input float number) → input int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `input float` | yes | The value to be rounded. |

**Returns**

`input int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.round Example", overlay=false)
rounded = math.round(close, 2)
plot(rounded, title="Close to 2 Decimals", color=color.blue)
```

## `math.round` (function, overload 3)

**Definition**

Rounds `number` to the nearest whole number and returns an int.

Pass a `precision` as well and the function keeps decimal places instead: the result is then a float, not an int. That change of return type is the practical difference between the two forms, so pick the form by what you need back - an int to count with, a float to plot.

In the series form the precision is itself series, so how many places you keep can differ from bar to bar.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.round(simple float number) → simple int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `simple float` | yes | The value to be rounded. |

**Returns**

`simple int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.round Example", overlay=false)
rounded = math.round(close, 2)
plot(rounded, title="Close to 2 Decimals", color=color.blue)
```

## `math.round` (function, overload 4)

**Definition**

Rounds `number` to the nearest whole number and returns an int.

Pass a `precision` as well and the function keeps decimal places instead: the result is then a float, not an int. That change of return type is the practical difference between the two forms, so pick the form by what you need back - an int to count with, a float to plot.

In the series form the precision is itself series, so how many places you keep can differ from bar to bar.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.round(series float number) → series int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `series float` | yes | The value to be rounded. |

**Returns**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.round Example", overlay=false)
rounded = math.round(close, 2)
plot(rounded, title="Close to 2 Decimals", color=color.blue)
```

## `math.round` (function, overload 5)

**Definition**

Rounds `number` to the nearest whole number and returns an int.

Pass a `precision` as well and the function keeps decimal places instead: the result is then a float, not an int. That change of return type is the practical difference between the two forms, so pick the form by what you need back - an int to count with, a float to plot.

In the series form the precision is itself series, so how many places you keep can differ from bar to bar.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.round(const float number, const int precision) → const float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `const float` | yes | The value to be rounded. |
| `precision` | `const int` | yes | Decimal places to which `number` is rounded. |

**Returns**

`const float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.round Example", overlay=false)
rounded = math.round(close, 2)
plot(rounded, title="Close to 2 Decimals", color=color.blue)
```

## `math.round` (function, overload 6)

**Definition**

Rounds `number` to the nearest whole number and returns an int.

Pass a `precision` as well and the function keeps decimal places instead: the result is then a float, not an int. That change of return type is the practical difference between the two forms, so pick the form by what you need back - an int to count with, a float to plot.

In the series form the precision is itself series, so how many places you keep can differ from bar to bar.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.round(input float number, input int precision) → input float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `input float` | yes | The value to be rounded. |
| `precision` | `input int` | yes | Decimal places to which `number` is rounded. |

**Returns**

`input float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.round Example", overlay=false)
rounded = math.round(close, 2)
plot(rounded, title="Close to 2 Decimals", color=color.blue)
```

## `math.round` (function, overload 7)

**Definition**

Rounds `number` to the nearest whole number and returns an int.

Pass a `precision` as well and the function keeps decimal places instead: the result is then a float, not an int. That change of return type is the practical difference between the two forms, so pick the form by what you need back - an int to count with, a float to plot.

In the series form the precision is itself series, so how many places you keep can differ from bar to bar.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.round(simple float number, simple int precision) → simple float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `simple float` | yes | The value to be rounded. |
| `precision` | `simple int` | yes | Decimal places to which `number` is rounded. |

**Returns**

`simple float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.round Example", overlay=false)
rounded = math.round(close, 2)
plot(rounded, title="Close to 2 Decimals", color=color.blue)
```

## `math.round` (function, overload 8)

**Definition**

Rounds `number` to the nearest whole number and returns an int.

Pass a `precision` as well and the function keeps decimal places instead: the result is then a float, not an int. That change of return type is the practical difference between the two forms, so pick the form by what you need back - an int to count with, a float to plot.

In the series form the precision is itself series, so how many places you keep can differ from bar to bar.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.round(series float number, series int precision) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `series float` | yes | The value to be rounded. |
| `precision` | `series int` | yes | Decimal places to which `number` is rounded. |

**Returns**

`series float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.round Example", overlay=false)
rounded = math.round(close, 2)
plot(rounded, title="Close to 2 Decimals", color=color.blue)
```

## `math.round_to_mintick` (function, overload 1)

**Definition**

Rounds `number` to the nearest multiple of `syminfo.mintick` for the chart symbol.

Uses `floor(number / mintick + 0.5) * mintick`. Returns `na` when the input is `na` or when `syminfo.mintick` is not available.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.round_to_mintick(const float number) → const float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `const float` | yes | Value to round to the instrument's minimum tick size. |

**Returns**

`const float`

Rounded float on the symbol's tick grid.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.round_to_mintick Example", overlay=true)
plot(math.round_to_mintick(close), title="Close on tick grid")
```

## `math.round_to_mintick` (function, overload 2)

**Definition**

Rounds `number` to the nearest multiple of `syminfo.mintick` for the chart symbol.

Uses `floor(number / mintick + 0.5) * mintick`. Returns `na` when the input is `na` or when `syminfo.mintick` is not available.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.round_to_mintick(input float number) → input float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `input float` | yes | Value to round to the instrument's minimum tick size. |

**Returns**

`input float`

Rounded float on the symbol's tick grid.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.round_to_mintick Example", overlay=true)
plot(math.round_to_mintick(close), title="Close on tick grid")
```

## `math.round_to_mintick` (function, overload 3)

**Definition**

Rounds `number` to the nearest multiple of `syminfo.mintick` for the chart symbol.

Uses `floor(number / mintick + 0.5) * mintick`. Returns `na` when the input is `na` or when `syminfo.mintick` is not available.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.round_to_mintick(simple float number) → simple float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `simple float` | yes | Value to round to the instrument's minimum tick size. |

**Returns**

`simple float`

Rounded float on the symbol's tick grid.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.round_to_mintick Example", overlay=true)
plot(math.round_to_mintick(close), title="Close on tick grid")
```

## `math.round_to_mintick` (function, overload 4)

**Definition**

Rounds `number` to the nearest multiple of `syminfo.mintick` for the chart symbol.

Uses `floor(number / mintick + 0.5) * mintick`. Returns `na` when the input is `na` or when `syminfo.mintick` is not available.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.round_to_mintick(series float number) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `series float` | yes | Value to round to the instrument's minimum tick size. |

**Returns**

`series float`

Rounded float on the symbol's tick grid.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.round_to_mintick Example", overlay=true)
plot(math.round_to_mintick(close), title="Close on tick grid")
```

## `math.sign` (function, overload 1)

**Definition**

The sign of `number`: -1 for a negative number and 1 for a positive one.

The result is a float, not an int. Every other member that reduces a number to a whole value - math.ceil, math.floor, the one-argument math.round - returns an int, so this one is worth reading twice.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.sign(const float number) → const float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `const float` | yes | The number to use in the calculation. |

**Returns**

`const float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.sign Example", overlay=false)
direction = math.sign(close - close[1])
plot(direction, title="Direction (-1, 0, 1)", color=color.blue)
```

## `math.sign` (function, overload 2)

**Definition**

The sign of `number`: -1 for a negative number and 1 for a positive one.

The result is a float, not an int. Every other member that reduces a number to a whole value - math.ceil, math.floor, the one-argument math.round - returns an int, so this one is worth reading twice.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.sign(input float number) → input float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `input float` | yes | The number to use in the calculation. |

**Returns**

`input float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.sign Example", overlay=false)
direction = math.sign(close - close[1])
plot(direction, title="Direction (-1, 0, 1)", color=color.blue)
```

## `math.sign` (function, overload 3)

**Definition**

The sign of `number`: -1 for a negative number and 1 for a positive one.

The result is a float, not an int. Every other member that reduces a number to a whole value - math.ceil, math.floor, the one-argument math.round - returns an int, so this one is worth reading twice.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.sign(simple float number) → simple float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `simple float` | yes | The number to use in the calculation. |

**Returns**

`simple float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.sign Example", overlay=false)
direction = math.sign(close - close[1])
plot(direction, title="Direction (-1, 0, 1)", color=color.blue)
```

## `math.sign` (function, overload 4)

**Definition**

The sign of `number`: -1 for a negative number and 1 for a positive one.

The result is a float, not an int. Every other member that reduces a number to a whole value - math.ceil, math.floor, the one-argument math.round - returns an int, so this one is worth reading twice.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.sign(series float number) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `series float` | yes | The number to use in the calculation. |

**Returns**

`series float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.sign Example", overlay=false)
direction = math.sign(close - close[1])
plot(direction, title="Direction (-1, 0, 1)", color=color.blue)
```

## `math.sin` (function, overload 1)

**Definition**

The sine of `angle`, where the angle is in radians.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.sin(const float angle) → const float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `const float` | yes | Angle, in radians. |

**Returns**

`const float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.sin Example", overlay=false)
wave = math.sin(bar_index * math.pi / 10)
plot(wave, title="Sine Wave", color=color.blue)
```

## `math.sin` (function, overload 2)

**Definition**

The sine of `angle`, where the angle is in radians.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.sin(input float angle) → input float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `input float` | yes | Angle, in radians. |

**Returns**

`input float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.sin Example", overlay=false)
wave = math.sin(bar_index * math.pi / 10)
plot(wave, title="Sine Wave", color=color.blue)
```

## `math.sin` (function, overload 3)

**Definition**

The sine of `angle`, where the angle is in radians.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.sin(simple float angle) → simple float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `simple float` | yes | Angle, in radians. |

**Returns**

`simple float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.sin Example", overlay=false)
wave = math.sin(bar_index * math.pi / 10)
plot(wave, title="Sine Wave", color=color.blue)
```

## `math.sin` (function, overload 4)

**Definition**

The sine of `angle`, where the angle is in radians.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.sin(series float angle) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `series float` | yes | Angle, in radians. |

**Returns**

`series float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.sin Example", overlay=false)
wave = math.sin(bar_index * math.pi / 10)
plot(wave, title="Sine Wave", color=color.blue)
```

## `math.sqrt` (function, overload 1)

**Definition**

The square root of `number`.

It is defined for a number that is not negative.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.sqrt(const float number) → const float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `const float` | yes | The number to use in the calculation. |

**Returns**

`const float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.sqrt Example", overlay=false)
// Volatility scaled by the square root of time
scaled = talib.stdev(close, 20) * math.sqrt(20)
plot(scaled, title="Scaled Volatility", color=color.blue)
```

## `math.sqrt` (function, overload 2)

**Definition**

The square root of `number`.

It is defined for a number that is not negative.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.sqrt(input float number) → input float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `input float` | yes | The number to use in the calculation. |

**Returns**

`input float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.sqrt Example", overlay=false)
// Volatility scaled by the square root of time
scaled = talib.stdev(close, 20) * math.sqrt(20)
plot(scaled, title="Scaled Volatility", color=color.blue)
```

## `math.sqrt` (function, overload 3)

**Definition**

The square root of `number`.

It is defined for a number that is not negative.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.sqrt(simple float number) → simple float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `simple float` | yes | The number to use in the calculation. |

**Returns**

`simple float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.sqrt Example", overlay=false)
// Volatility scaled by the square root of time
scaled = talib.stdev(close, 20) * math.sqrt(20)
plot(scaled, title="Scaled Volatility", color=color.blue)
```

## `math.sqrt` (function, overload 4)

**Definition**

The square root of `number`.

It is defined for a number that is not negative.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.sqrt(series float number) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `number` | `series float` | yes | The number to use in the calculation. |

**Returns**

`series float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.sqrt Example", overlay=false)
// Volatility scaled by the square root of time
scaled = talib.stdev(close, 20) * math.sqrt(20)
plot(scaled, title="Scaled Volatility", color=color.blue)
```

## `math.sum` (function)

**Definition**

Adds up the last `length` values of `source`.

Same behavior as `talib.sum` — a moving window, not a running total (`talib.cum`).

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.sum(series float source, series int length) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `source` | `series float` | yes | The series to add up. |
| `length` | `series int` | yes | How many bars the window covers. |

**Returns**

`series float`

A series float total.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Sum of Close Prices", overlay=false)
length = input(10, "Sum Length")
sumClose = math.sum(close, length)
plot(sumClose, color=color.blue, title="Sum of Close Prices")
```

## `math.tan` (function, overload 1)

**Definition**

The tangent of `angle`, where the angle is in radians.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.tan(const float angle) → const float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `const float` | yes | Angle, in radians. |

**Returns**

`const float`

**Notes**

* In this build `math.tan` returns `na` when `angle` is exactly 90 (radians); every other value gives the tangent. As the default of `input.float`, `math.tan(90)` is refused when the script is added to the chart ("Argument `defval` of `input.float()` cannot be `na`."), while `math.tan(89)` is accepted.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.tan Example", overlay=false)
value = math.tan(math.pi / 4)
plot(value, title="tan(45 deg) (1)", color=color.blue)
```

## `math.tan` (function, overload 2)

**Definition**

The tangent of `angle`, where the angle is in radians.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.tan(input float angle) → input float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `input float` | yes | Angle, in radians. |

**Returns**

`input float`

**Notes**

* In this build `math.tan` returns `na` when `angle` is exactly 90 (radians); every other value gives the tangent. As the default of `input.float`, `math.tan(90)` is refused when the script is added to the chart ("Argument `defval` of `input.float()` cannot be `na`."), while `math.tan(89)` is accepted.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.tan Example", overlay=false)
value = math.tan(math.pi / 4)
plot(value, title="tan(45 deg) (1)", color=color.blue)
```

## `math.tan` (function, overload 3)

**Definition**

The tangent of `angle`, where the angle is in radians.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.tan(simple float angle) → simple float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `simple float` | yes | Angle, in radians. |

**Returns**

`simple float`

**Notes**

* In this build `math.tan` returns `na` when `angle` is exactly 90 (radians); every other value gives the tangent. As the default of `input.float`, `math.tan(90)` is refused when the script is added to the chart ("Argument `defval` of `input.float()` cannot be `na`."), while `math.tan(89)` is accepted.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.tan Example", overlay=false)
value = math.tan(math.pi / 4)
plot(value, title="tan(45 deg) (1)", color=color.blue)
```

## `math.tan` (function, overload 4)

**Definition**

The tangent of `angle`, where the angle is in radians.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.tan(series float angle) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `angle` | `series float` | yes | Angle, in radians. |

**Returns**

`series float`

**Notes**

* In this build `math.tan` returns `na` when `angle` is exactly 90 (radians); every other value gives the tangent. As the default of `input.float`, `math.tan(90)` is refused when the script is added to the chart ("Argument `defval` of `input.float()` cannot be `na`."), while `math.tan(89)` is accepted.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.tan Example", overlay=false)
value = math.tan(math.pi / 4)
plot(value, title="tan(45 deg) (1)", color=color.blue)
```

## `math.todegrees` (function, overload 1)

**Definition**

Converts an angle in radians to the same angle in degrees.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.todegrees(const float radians) → const float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `radians` | `const float` | yes | Angle in radians. |

**Returns**

`const float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.todegrees Example", overlay=false)
degrees = math.todegrees(math.pi)
plot(degrees, title="pi in Degrees (180)", color=color.blue)
```

## `math.todegrees` (function, overload 2)

**Definition**

Converts an angle in radians to the same angle in degrees.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.todegrees(input float radians) → input float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `radians` | `input float` | yes | Angle in radians. |

**Returns**

`input float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.todegrees Example", overlay=false)
degrees = math.todegrees(math.pi)
plot(degrees, title="pi in Degrees (180)", color=color.blue)
```

## `math.todegrees` (function, overload 3)

**Definition**

Converts an angle in radians to the same angle in degrees.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.todegrees(simple float radians) → simple float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `radians` | `simple float` | yes | Angle in radians. |

**Returns**

`simple float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.todegrees Example", overlay=false)
degrees = math.todegrees(math.pi)
plot(degrees, title="pi in Degrees (180)", color=color.blue)
```

## `math.todegrees` (function, overload 4)

**Definition**

Converts an angle in radians to the same angle in degrees.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.todegrees(series float radians) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `radians` | `series float` | yes | Angle in radians. |

**Returns**

`series float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.todegrees Example", overlay=false)
degrees = math.todegrees(math.pi)
plot(degrees, title="pi in Degrees (180)", color=color.blue)
```

## `math.toradians` (function, overload 1)

**Definition**

Converts an angle in degrees to the same angle in radians.

The trigonometric functions take radians, so this is the conversion to reach for before calling them.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.toradians(const float degrees) → const float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `degrees` | `const float` | yes | Angle in degrees. |

**Returns**

`const float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.toradians Example", overlay=false)
radians = math.toradians(180)
plot(radians, title="180 Degrees in Radians (pi)", color=color.blue)
```

## `math.toradians` (function, overload 2)

**Definition**

Converts an angle in degrees to the same angle in radians.

The trigonometric functions take radians, so this is the conversion to reach for before calling them.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.toradians(input float degrees) → input float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `degrees` | `input float` | yes | Angle in degrees. |

**Returns**

`input float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.toradians Example", overlay=false)
radians = math.toradians(180)
plot(radians, title="180 Degrees in Radians (pi)", color=color.blue)
```

## `math.toradians` (function, overload 3)

**Definition**

Converts an angle in degrees to the same angle in radians.

The trigonometric functions take radians, so this is the conversion to reach for before calling them.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.toradians(simple float degrees) → simple float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `degrees` | `simple float` | yes | Angle in degrees. |

**Returns**

`simple float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.toradians Example", overlay=false)
radians = math.toradians(180)
plot(radians, title="180 Degrees in Radians (pi)", color=color.blue)
```

## `math.toradians` (function, overload 4)

**Definition**

Converts an angle in degrees to the same angle in radians.

The trigonometric functions take radians, so this is the conversion to reach for before calling them.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
math.toradians(series float degrees) → series float
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `degrees` | `series float` | yes | Angle in degrees. |

**Returns**

`series float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("math.toradians Example", overlay=false)
radians = math.toradians(180)
plot(radians, title="180 Degrees in Radians (pi)", color=color.blue)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.