> ## 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.

# Global functions

> Reference for the 40 functions (79 entries with overloads) of the global scope (the names with no namespace): alert, alertcondition, barcolor, bgcolor and 36 more, each with its definition and an example.

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

## `alert` (function)

**Definition**

Raises an alert from inside your own logic, with a message you build.

It is the one output-shaped function with no top-level rule, so it may be called inside a branch — which is what makes "alert me when this happens" expressible. It fires at most once per bar, only on realtime bars, and only when the script is running as an alert; on historical bars it does nothing.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
alert(series string message) → void
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `message` | `series string` | yes | The custom text message shown in the alert notification |

**Returns**

`void`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("RSI Alert", overlay=false)

rsi = talib.rsi(close, 14)

if talib.crossover(rsi, 70) {
    alert("RSI crossed above 70!")
}
```

## `alertcondition` (function)

**Definition**

Declares a condition the platform can offer to the reader. It raises nothing by itself.

Unlike `alert`, it must be called at the top level, and its title and message are const-form — fixed when the script is compiled. Left out, both read `na`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
alertcondition(series bool condition, const string title, const string message) → void
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `condition` | `series bool` | yes | Represents a Boolean expression or logic that determines when the alert should fire. | |
| `title` | `const string` | no | Represents the name the alert condition. | `na` |
| `message` | `const string` | no | Represents the text message that will be shown or sent when the alert is triggered. | `na` |

**Returns**

`void`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Volume > 10 Alert", overlay=false)

// Condition
volAbove10 = volume > 10

// Plotting for visual reference
plot(volume, title="Volume", color=color.blue, style=plotStyle.bar)

// Alert condition
alertcondition(volAbove10, title="Volume Greater Than 10", message="Volume has crossed above 10")
```

## `barcolor` (function)

**Definition**

Recolours the chart's own price bars. It draws no value of its own.

To colour only some bars, vary the colour rather than the call: the colour argument is series-form, while the call has to stay at the top level. Note that every argument here is optional, `color` included.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
barcolor(series color color, const string title, input int offset, input display display) → void
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `color` | `series color` | no | Bar color. Use a color constant such as `color.blue`, a hex color such as `#00ff7f`, or an expression that returns a color, such as `close >= open ? color.yellow : color.blue`. Optional. | | `na` |
| `title` | `const string` | no | Title of the barcolor. Optional argument | | `na` |
| `offset` | `input int` | no | Shifts the color series to the left or to the right on the given number of bars. Default is 0. | | `0` |
| `display` | `input display` | no | Whether the bar colors are shown: `display.all` (the default) or `display.none`. The other `display.*` constants are not supported here. | `display.all`, `display.none` | `display.all` |

**Returns**

`void`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Custom Bar Color", overlay=true)
// Define conditions for different colors
bullish = close > open
bearish = close < open
neutral = close == open
// Assign colors based on conditions
barColor = bullish ? color.green : bearish ? color.red : color.gray
// Apply bar color
barcolor(barColor)
```

## `bgcolor` (function)

**Definition**

Shades the pane's background. Like `barcolor` it adds no value to the chart.

It differs from `barcolor` in one way that matters: it takes a `force_overlay` argument and `barcolor` does not.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
bgcolor(series color color, const string title, input int offset, const bool force_overlay, input display display) → void
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `color` | `series color` | no | Color of the filled background. Use a color constant such as `color.blue`, a hex color such as `#00ff7f`, or an expression that returns a color, such as `close >= open ? color.yellow : color.blue`. Optional. | | `na` |
| `title` | `const string` | no | Title of the bgcolor. Optional argument | | `na` |
| `offset` | `input int` | no | Shifts the color series to the left or to the right on the given number of bars. Default is 0. | | `0` |
| `force_overlay` | `const bool` | no | If true, the plotted results will display on the main chart pane, Optional. The default is false. | | `false` |
| `display` | `input display` | no | Whether the background color is shown: `display.all` (the default) or `display.none`. The other `display.*` constants are not supported here. | `display.all`, `display.none` | `display.all` |

**Returns**

`void`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Custom Background Color", overlay=true)
bullish = close > open
bearish = close < open
bgColor = bullish ? color.green : bearish ? color.red : na
bgcolor(bgColor)
```

## `bool` (function, overload 1)

**Definition**

Declares a value as a bool.

A number becomes `false` when it is zero and `true` otherwise, so `bool(2)` is `true`. Most functions with a bool argument convert a number the same way; `alertcondition` does not and needs a bool expression ("The `condition` argument of `alertcondition()` must be a boolean series.").

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
bool(const bool value) → const bool
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `const bool` | yes | The value to convert to the specified type, usually na. |

**Returns**

`const bool`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("bool() Example", overlay=true)
// A typed na: the variable is known to be bool before it has a value
bool signal = bool(na)
signal := close > open
bgcolor(signal ? color.new(color.green, 0.2) : na)
```

## `bool` (function, overload 2)

**Definition**

Declares a value as a bool.

A number becomes `false` when it is zero and `true` otherwise, so `bool(2)` is `true`. Most functions with a bool argument convert a number the same way; `alertcondition` does not and needs a bool expression ("The `condition` argument of `alertcondition()` must be a boolean series.").

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
bool(input bool value) → input bool
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `input bool` | yes | The value to convert to the specified type, usually na. |

**Returns**

`input bool`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("bool() Example", overlay=true)
// A typed na: the variable is known to be bool before it has a value
bool signal = bool(na)
signal := close > open
bgcolor(signal ? color.new(color.green, 0.2) : na)
```

## `bool` (function, overload 3)

**Definition**

Declares a value as a bool.

A number becomes `false` when it is zero and `true` otherwise, so `bool(2)` is `true`. Most functions with a bool argument convert a number the same way; `alertcondition` does not and needs a bool expression ("The `condition` argument of `alertcondition()` must be a boolean series.").

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
bool(simple bool value) → simple bool
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `simple bool` | yes | The value to convert to the specified type, usually na. |

**Returns**

`simple bool`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("bool() Example", overlay=true)
// A typed na: the variable is known to be bool before it has a value
bool signal = bool(na)
signal := close > open
bgcolor(signal ? color.new(color.green, 0.2) : na)
```

## `bool` (function, overload 4)

**Definition**

Declares a value as a bool.

A number becomes `false` when it is zero and `true` otherwise, so `bool(2)` is `true`. Most functions with a bool argument convert a number the same way; `alertcondition` does not and needs a bool expression ("The `condition` argument of `alertcondition()` must be a boolean series.").

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
bool(series bool value) → series bool
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `series bool` | yes | The value to convert to the specified type, usually na. |

**Returns**

`series bool`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("bool() Example", overlay=true)
// A typed na: the variable is known to be bool before it has a value
bool signal = bool(na)
signal := close > open
bgcolor(signal ? color.new(color.green, 0.2) : na)
```

## `box` (function)

**Definition**

Converts `value` to the `box` type. It is used almost only as `box(na)`, to declare a box variable that has no drawing yet, so that its type is known before the first drawing is assigned.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
box(series box value) → series box
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `series box` | yes | The value to convert to the specified type, usually na. |

**Returns**

`series box`

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("box() Example", overlay=true)
static box rangeBox = box(na)
if barstate.islast {
    rangeBox := box.new(bar_index[10], talib.highest(high, 10), bar_index, talib.lowest(low, 10), border_color=color.blue, bgcolor=color.new(color.blue, 0.2), textcolor=color.white)
}
```

## `color` (function, overload 1)

**Definition**

Converts a value to a colour.

It accepts a colour only. The `color` namespace holds the functions that build a colour from components or read one apart.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
color(const color value) → const color
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `const color` | yes | The value to convert to the specified type, usually na. |

**Returns**

`const color`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("color() Example", overlay=true)
// A typed na colour, set only on up bars
color c = color(na)
if close > open {
    c := color.green
}
barcolor(c)
```

## `color` (function, overload 2)

**Definition**

Converts a value to a colour.

It accepts a colour only. The `color` namespace holds the functions that build a colour from components or read one apart.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
color(input color value) → input color
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `input color` | yes | The value to convert to the specified type, usually na. |

**Returns**

`input color`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("color() Example", overlay=true)
// A typed na colour, set only on up bars
color c = color(na)
if close > open {
    c := color.green
}
barcolor(c)
```

## `color` (function, overload 3)

**Definition**

Converts a value to a colour.

It accepts a colour only. The `color` namespace holds the functions that build a colour from components or read one apart.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
color(simple color value) → simple color
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `simple color` | yes | The value to convert to the specified type, usually na. |

**Returns**

`simple color`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("color() Example", overlay=true)
// A typed na colour, set only on up bars
color c = color(na)
if close > open {
    c := color.green
}
barcolor(c)
```

## `color` (function, overload 4)

**Definition**

Converts a value to a colour.

It accepts a colour only. The `color` namespace holds the functions that build a colour from components or read one apart.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
color(series color value) → series color
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `series color` | yes | The value to convert to the specified type, usually na. |

**Returns**

`series color`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("color() Example", overlay=true)
// A typed na colour, set only on up bars
color c = color(na)
if close > open {
    c := color.green
}
barcolor(c)
```

## `dayofmonth` (function)

**Definition**

The day of the month of a time you supply.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
dayofmonth(series int time, series string timezone) → series int
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `time` | `series int` | yes | UNIX time, in milliseconds. | |
| `timezone` | `series string` | no | The time zone the value is read in: an IANA time zone database name (for example "America/New\_York") or "UTC". Unlike `timestamp`, `time` and `str.format_time`, this function does not accept offset notation such as "UTC-5" or "GMT+0530": a name that cannot be loaded gives 0, not `na`. | `syminfo.timezone` |

**Returns**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Day of Month Example", overlay=true)
// Get current bar day of month
currentDay = dayofmonth(time)
// Plot day in Data Window
plot(currentDay, title="Current Day")
```

## `dayofweek` (function)

**Definition**

The day of the week of a time you supply, as an int series.

Uses the same numbering as the `dayofweek` variable: Sunday `1` through Saturday `7` (`dayofweek.sunday` … `dayofweek.saturday`).

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
dayofweek(series int time, series string timezone) → series int
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `time` | `series int` | yes | UNIX time, in milliseconds. | |
| `timezone` | `series string` | no | The time zone the value is read in: an IANA time zone database name (for example "America/New\_York") or "UTC". Unlike `timestamp`, `time` and `str.format_time`, this function does not accept offset notation such as "UTC-5" or "GMT+0530": a name that cannot be loaded gives 0, not `na`. | `syminfo.timezone` |

**Returns**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Day of Week Example", overlay=true)
// Get current bar day of week
currentDay = dayofweek(time)
// Plot day in Data Window
plot(currentDay, title="Current Day")
```

## `fill` (function, overload 1)

**Definition**

Shades the band between two plots, or between two horizontal lines. It has two forms and no mixed one, so you cannot fill between a plot and a level, and like the other output calls it must sit at the top level.

The forms differ in argument order, and that is the thing that bites: for two levels the third argument is the colour, for two plots it is the title. Name the arguments and the difference stops mattering. When you fill between two plots, the fill keeps an offset only if both plots carry the same one.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
fill(series hline h1, series hline h2, series color color, const string title, const bool fillgaps, input display display) → void
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `h1` | `series hline` | yes | The first hline object. Required argument. | | |
| `h2` | `series hline` | yes | The second hline object. Required argument. | | |
| `color` | `series color` | no | Color of the background fill. Use a color constant such as `color.blue`, a hex color such as `#00ff7f`, or an expression that returns a color, such as `close >= open ? color.yellow : color.blue`. Optional. | | `na` |
| `title` | `const string` | no | Title of the created fill object. Optional argument. | | `na` |
| `fillgaps` | `const bool` | no | Controls continuing fills on gaps, i.e., when one of the plot() calls returns an na value. When true, the last fill will continue on gaps. The default is false. | | `false` |
| `display` | `input display` | no | Whether the fill is shown: `display.all` (the default) or `display.none`. The other `display.*` constants are not supported here. | `display.all`, `display.none` | `display.all` |

**Returns**

`void`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Fill Example", overlay=true)
// Create two moving averages
ma1 = talib.sma(close, 20)
ma2 = talib.sma(close, 50)
// Plot moving averages
plot1 = plot(ma1, color=color.blue, title="MA 20")
plot2 = plot(ma2, color=color.orange, title="MA 50")
// Fill the area between MA 20 and MA 50
fill(plot1, plot2, color=color.new(color.green, 0.1))
```

## `fill` (function, overload 2)

**Definition**

Shades the band between two plots, or between two horizontal lines. It has two forms and no mixed one, so you cannot fill between a plot and a level, and like the other output calls it must sit at the top level.

The forms differ in argument order, and that is the thing that bites: for two levels the third argument is the colour, for two plots it is the title. Name the arguments and the difference stops mattering. When you fill between two plots, the fill keeps an offset only if both plots carry the same one.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
fill(series hline h1, series hline h2, series float top_value, series float bottom_value, series color top_color, series color bottom_color, const string title, input display display, const bool fillgaps, input bool editable) → void
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `h1` | `series hline` | yes | The first hline object. Required argument. | | |
| `h2` | `series hline` | yes | The second hline object. Required argument. | | |
| `top_value` | `series float` | yes | Price at which the fill has `top_color`. With `bottom_value` it sets, on each bar, the price range the gradient spans. | | |
| `bottom_value` | `series float` | yes | Price at which the fill has `bottom_color`. | | |
| `top_color` | `series color` | yes | Color of the fill at `top_value`. Between the two values the color changes gradually from `top_color` to `bottom_color`. | | |
| `bottom_color` | `series color` | yes | Color of the fill at `bottom_value`. | | |
| `title` | `const string` | no | Title of the created fill object. Optional argument. | | `na` |
| `display` | `input display` | no | Whether the fill is shown: `display.all` (the default) or `display.none`. The other `display.*` constants are not supported here. | `display.all`, `display.none` | `display.all` |
| `fillgaps` | `const bool` | no | Controls continuing fills on gaps, i.e., when one of the plot() calls returns an na value. When true, the last fill will continue on gaps. The default is false. | | `false` |
| `editable` | `input bool` | no | If true (the default), the reader can change the fill's colors in the script's settings. | | `true` |

**Returns**

`void`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Fill Example", overlay=true)
// Create two moving averages
ma1 = talib.sma(close, 20)
ma2 = talib.sma(close, 50)
// Plot moving averages
plot1 = plot(ma1, color=color.blue, title="MA 20")
plot2 = plot(ma2, color=color.orange, title="MA 50")
// Fill the area between MA 20 and MA 50
fill(plot1, plot2, color=color.new(color.green, 0.1))
```

## `fill` (function, overload 3)

**Definition**

Shades the band between two plots, or between two horizontal lines. It has two forms and no mixed one, so you cannot fill between a plot and a level, and like the other output calls it must sit at the top level.

The forms differ in argument order, and that is the thing that bites: for two levels the third argument is the colour, for two plots it is the title. Name the arguments and the difference stops mattering. When you fill between two plots, the fill keeps an offset only if both plots carry the same one.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
fill(series plot p1, series plot p2, const string title, series color color, const bool fillgaps, input display display) → void
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `p1` | `series plot` | yes | The first plot object. Required argument. | | |
| `p2` | `series plot` | yes | The second plot object. Required argument. | | |
| `title` | `const string` | no | Title of the created fill object. Optional argument. | | `na` |
| `color` | `series color` | no | Color of the background fill. Use a color constant such as `color.blue`, a hex color such as `#00ff7f`, or an expression that returns a color, such as `close >= open ? color.yellow : color.blue`. Optional. | | `na` |
| `fillgaps` | `const bool` | no | Controls continuing fills on gaps, i.e., when one of the plot() calls returns an na value. When true, the last fill will continue on gaps. The default is false. | | `false` |
| `display` | `input display` | no | Whether the fill is shown: `display.all` (the default) or `display.none`. The other `display.*` constants are not supported here. | `display.all`, `display.none` | `display.all` |

**Returns**

`void`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Fill Example", overlay=true)
// Create two moving averages
ma1 = talib.sma(close, 20)
ma2 = talib.sma(close, 50)
// Plot moving averages
plot1 = plot(ma1, color=color.blue, title="MA 20")
plot2 = plot(ma2, color=color.orange, title="MA 50")
// Fill the area between MA 20 and MA 50
fill(plot1, plot2, color=color.new(color.green, 0.1))
```

## `fill` (function, overload 4)

**Definition**

Shades the band between two plots, or between two horizontal lines. It has two forms and no mixed one, so you cannot fill between a plot and a level, and like the other output calls it must sit at the top level.

The forms differ in argument order, and that is the thing that bites: for two levels the third argument is the colour, for two plots it is the title. Name the arguments and the difference stops mattering. When you fill between two plots, the fill keeps an offset only if both plots carry the same one.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
fill(series plot plot1, series plot plot2, series float top_value, series float bottom_value, series color top_color, series color bottom_color, const string title, input display display, const bool fillgaps, input bool editable) → void
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `plot1` | `series plot` | yes | The first plot, the result of a `plot` call. | | |
| `plot2` | `series plot` | yes | The second plot, the result of a `plot` call. | | |
| `top_value` | `series float` | yes | Price at which the fill has `top_color`. With `bottom_value` it sets, on each bar, the price range the gradient spans. | | |
| `bottom_value` | `series float` | yes | Price at which the fill has `bottom_color`. | | |
| `top_color` | `series color` | yes | Color of the fill at `top_value`. Between the two values the color changes gradually from `top_color` to `bottom_color`. | | |
| `bottom_color` | `series color` | yes | Color of the fill at `bottom_value`. | | |
| `title` | `const string` | no | Title of the created fill object. Optional argument. | | `na` |
| `display` | `input display` | no | Whether the fill is shown: `display.all` (the default) or `display.none`. The other `display.*` constants are not supported here. | `display.all`, `display.none` | `display.all` |
| `fillgaps` | `const bool` | no | Controls continuing fills on gaps, i.e., when one of the plot() calls returns an na value. When true, the last fill will continue on gaps. The default is false. | | `false` |
| `editable` | `input bool` | no | If true (the default), the reader can change the fill's colors in the script's settings. | | `true` |

**Returns**

`void`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Fill Example", overlay=true)
// Create two moving averages
ma1 = talib.sma(close, 20)
ma2 = talib.sma(close, 50)
// Plot moving averages
plot1 = plot(ma1, color=color.blue, title="MA 20")
plot2 = plot(ma2, color=color.orange, title="MA 50")
// Fill the area between MA 20 and MA 50
fill(plot1, plot2, color=color.new(color.green, 0.1))
```

## `fixnan` (function, overload 1)

**Definition**

Takes a series and hands back a series of the same type, with `na` values dealt with.

Four overloads cover bool, colour, float and int. Where `nz` lets you name the replacement, `fixnan` takes no second argument.

**Syntax**

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

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `series int` | yes | Source used for the calculation. |

**Returns**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("fixnan Example", overlay=true)
// Carry the last pivot high forward until the next one
ph = talib.pivothigh(high, 5, 5)
plot(fixnan(ph), title="Last Pivot High", color=color.green)
```

## `fixnan` (function, overload 2)

**Definition**

Takes a series and hands back a series of the same type, with `na` values dealt with.

Four overloads cover bool, colour, float and int. Where `nz` lets you name the replacement, `fixnan` takes no second argument.

**Syntax**

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

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `series float` | yes | Source used for the calculation. |

**Returns**

`series float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("fixnan Example", overlay=true)
// Carry the last pivot high forward until the next one
ph = talib.pivothigh(high, 5, 5)
plot(fixnan(ph), title="Last Pivot High", color=color.green)
```

## `fixnan` (function, overload 3)

**Definition**

Takes a series and hands back a series of the same type, with `na` values dealt with.

Four overloads cover bool, colour, float and int. Where `nz` lets you name the replacement, `fixnan` takes no second argument.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
fixnan(series bool value) → series bool
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `series bool` | yes | Source used for the calculation. |

**Returns**

`series bool`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("fixnan Example", overlay=true)
// Carry the last pivot high forward until the next one
ph = talib.pivothigh(high, 5, 5)
plot(fixnan(ph), title="Last Pivot High", color=color.green)
```

## `fixnan` (function, overload 4)

**Definition**

Takes a series and hands back a series of the same type, with `na` values dealt with.

Four overloads cover bool, colour, float and int. Where `nz` lets you name the replacement, `fixnan` takes no second argument.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
fixnan(series color value) → series color
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `series color` | yes | Source used for the calculation. |

**Returns**

`series color`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("fixnan Example", overlay=true)
// Carry the last pivot high forward until the next one
ph = talib.pivothigh(high, 5, 5)
plot(fixnan(ph), title="Last Pivot High", color=color.green)
```

## `float` (function, overload 1)

**Definition**

Converts a value to a float.

It accepts an int as well as a float, so it is the conversion to use when a calculation must not round.

**Syntax**

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

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `const float` | yes | The value to convert to the specified type, usually na. |

**Returns**

`const float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("float() Example", overlay=false)
// Dividing as floats keeps the fractional part
ratio = float(bar_index) / 7
plot(ratio, title="Bar Index / 7", color=color.blue)
```

## `float` (function, overload 2)

**Definition**

Converts a value to a float.

It accepts an int as well as a float, so it is the conversion to use when a calculation must not round.

**Syntax**

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

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `input float` | yes | The value to convert to the specified type, usually na. |

**Returns**

`input float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("float() Example", overlay=false)
// Dividing as floats keeps the fractional part
ratio = float(bar_index) / 7
plot(ratio, title="Bar Index / 7", color=color.blue)
```

## `float` (function, overload 3)

**Definition**

Converts a value to a float.

It accepts an int as well as a float, so it is the conversion to use when a calculation must not round.

**Syntax**

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

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `simple float` | yes | The value to convert to the specified type, usually na. |

**Returns**

`simple float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("float() Example", overlay=false)
// Dividing as floats keeps the fractional part
ratio = float(bar_index) / 7
plot(ratio, title="Bar Index / 7", color=color.blue)
```

## `float` (function, overload 4)

**Definition**

Converts a value to a float.

It accepts an int as well as a float, so it is the conversion to use when a calculation must not round.

**Syntax**

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

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `series float` | yes | The value to convert to the specified type, usually na. |

**Returns**

`series float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("float() Example", overlay=false)
// Dividing as floats keeps the fractional part
ratio = float(bar_index) / 7
plot(ratio, title="Bar Index / 7", color=color.blue)
```

## `hline` (function)

**Definition**

Draws a horizontal line at a fixed price.

The price is input-form, so it cannot follow the data — a line that has to move is a plot, not a level. `hline` returns a value, which is what lets you pass two levels to `fill`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
hline(input float price, const string title, input color color, input int linewidth, input hlineStyle style, input display display, input string format) → series hline
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `price` | `input float` | yes | Price value at which the object will be rendered. Required argument. | | |
| `title` | `const string` | no | Title of the object. | | `na` |
| `color` | `input color` | no | Color of the rendered line. Must be an `input.color` value or a constant expression; a series color is refused ("An argument of `series color` type was used but a `input color` is expected."). Optional argument. | | `na` |
| `linewidth` | `input int` | no | Width of the rendered line. Default value is 1. | | `1` |
| `style` | `input hlineStyle` | no | Style of the rendered line. Possible values are: hlineStyle.solid, hlineStyle.dotted, hlineStyle.dashed. Optional argument. | `hlineStyle.solid`, `hlineStyle.dashed`, `hlineStyle.dotted` | `hlineStyle.solid` |
| `display` | `input display` | no | Controls where the hline is shown (pane, price scale, status line, data window). Use display.\* constants; combine with +. Default is display.all. | `display.none`, `display.pane`, `display.data_window`, `display.price_scale`, `display.status_line`, `display.all` | `display.all` |
| `format` | `input string` | no | Format of the displayed values: `format.price`, `format.percent` or `format.volume`. The default is an empty string, which uses the script's format. `format.inherit` and `format.mintick` pass the editor's check but are refused when the script is added to the chart. | `format.percent`, `format.price`, `format.volume` | `""` |

**Returns**

`series hline`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Horizontal Line Example", overlay=true)
// Draw a horizontal line at 4000
hline(4000, "Support Level", color=color.blue, linewidth=2, style=hlineStyle.dashed)
```

## `hour` (function)

**Definition**

The hour of a time you supply.

Because the timezone is an argument rather than an assumption, a script can ask the same question in two zones.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
hour(series int time, series string timezone) → series int
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `time` | `series int` | yes | UNIX time, in milliseconds. | |
| `timezone` | `series string` | no | The time zone the value is read in: an IANA time zone database name (for example "America/New\_York") or "UTC". Unlike `timestamp`, `time` and `str.format_time`, this function does not accept offset notation such as "UTC-5" or "GMT+0530": a name that cannot be loaded gives 0, not `na`. | `syminfo.timezone` |

**Returns**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Hour Function Example", overlay=true)
// Get current bar hour
currentHour = hour(time)
// Plot hour in Data Window
plot(currentHour, title="Current Hour")
```

## `indicator` (function)

**Definition**

Declares the script and names it. Put it first.

Only `title` is required, and every parameter is const-form, so none of them can be built from series data or handed a value that came out of an input.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
indicator(const string title, const string shorttitle, const bool overlay, const string format, const int precision, const scale scale, const bool calc_on_every_tick, const int max_lines_count, const int max_labels_count, const int max_boxes_count, const int calc_bars_count, const int max_polylines_count, const bool behind_chart) → void
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `title` | `const string` | yes | The title of the script. It is displayed on the chart when no shorttitle argument is used, and becomes the script's default title when you publish it. | | |
| `shorttitle` | `const string` | no | The script's display name on charts. If specified, it will replace the title argument in most chart-related windows. Optional. The default is the argument used for title. At most 128 characters: a longer name passes the editor's check but is refused when the script is added to the chart. | | |
| `overlay` | `const bool` | no | If true, the indicator will be displayed over the chart. If false, it will be added in a separate pane. Optional. The default is false. | | `false` |
| `format` | `const string` | no | How the script's values are formatted on the price scale and in the status line: `format.inherit` (the default: as the chart's symbol), `format.price`, `format.volume` or `format.percent`. Any other `format.*` constant passes the editor's check but is refused when the script is added to the chart. | `format.inherit`, `format.percent`, `format.price`, `format.volume` | `format.inherit` |
| `precision` | `const int` | no | Number of digits after the decimal point in the script's displayed values. Accepted, but the current compiler does not pass it on, so it has no effect yet. | | `0` |
| `scale` | `const scale` | no | Which price scale the script uses: `scale.left`, `scale.right`, or `scale.none`. Optional. Default is `scale.none`. | | `scale.none` |
| `calc_on_every_tick` | `const bool` | no | If true, the indicator recalculates on every realtime tick update of the last bar. If false, it recalculates only when the bar is confirmed. Optional. The default is true. | | `true` |
| `max_lines_count` | `const int` | no | Maximum lines the script may keep. Default is 50, and the highest accepted value is 500. Past the limit, the oldest lines are trimmed. | | `50` |
| `max_labels_count` | `const int` | no | Maximum labels the script may keep. Default is 50, and the highest accepted value is 500. Past the limit, the oldest labels are trimmed. | | `50` |
| `max_boxes_count` | `const int` | no | Maximum boxes the script may keep. Default is 50, and the highest accepted value is 500. Past the limit, the oldest boxes are trimmed. | | `50` |
| `calc_bars_count` | `const int` | no | Limits how many historical bars are calculated (0 means no limit). Must be 0 or a positive integer; a negative value passes the editor's check but is refused when the script is added to the chart. | | `0` |
| `max_polylines_count` | `const int` | no | Maximum polylines the script may keep. Default is 50, and the highest accepted value is 100. Past the limit, the oldest polylines are trimmed. | | `50` |
| `behind_chart` | `const bool` | no | If true, plot drawings render behind the chart candles. Optional. Default is true. | | `true` |

**Returns**

`void`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator(title="Simple Moving Average", overlay=true,shorttitle="SMA")
sma_value = talib.sma(close, 14)
plot(sma_value, title="SMA 14", color=color.blue, linewidth=2)
```

## `input` (function, overload 1)

**Definition**

Declares a setting the reader can change from the chart, picking its kind from the type of the default value you hand it.

Six forms exist. Give it a bool and you get a bool back; give it a colour, a float, an int or a string and the same holds. The sixth takes a series and returns a `series float`, which is how you offer a choice of chart data without naming `input.source`. There are no bounds and no step here — for those, use `input.int` or `input.float`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
input(const color defval, const string title, const string tooltip, const string inline, const string group, const bool confirm, const display display) → input color
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `defval` | `const color` | yes | Default value of the input. The reader can change it from the chart. | | |
| `title` | `const string` | no | Title of the input. If not specified, the title is `Untitled`. If the title is specified but empty, the title is an empty string. | | `"Untitled"` |
| `tooltip` | `const string` | no | Text of a tooltip shown with the input. | | `""` |
| `inline` | `const string` | no | Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line. | | `""` |
| `group` | `const string` | no | Creates a header above all inputs using the same group argument string. The string is also used as the header's text. | | `""` |
| `confirm` | `const bool` | no | If true, the reader is asked to confirm the value before the script is added to the chart. The default is false. | | `false` |
| `display` | `const display` | no | Where the input's value is shown outside the script's settings, as a `display.*` constant: `display.status_line`, `display.data_window`, `display.all` or `display.none`. Combine constants with `+`. The default is `display.none`: the value is shown only in the settings. | `display.none`, `display.data_window`, `display.status_line`, `display.all` | `display.none` |

**Returns**

`input color`

**Notes**

* The default `defval` must be a value: `na` is rejected with "Argument `defval` of `input()` cannot be `na`." Any constant expression of type color is accepted, such as `color.red` or `color.new(color.red, 0.5)`.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Customizable Moving Average", overlay=true)
length = input(14, title="SMA Length")
sma_value = talib.sma(close, length)
plot(sma_value, title="SMA", color=color.blue, linewidth=2)
```

## `input` (function, overload 2)

**Definition**

Declares a setting the reader can change from the chart, picking its kind from the type of the default value you hand it.

Six forms exist. Give it a bool and you get a bool back; give it a colour, a float, an int or a string and the same holds. The sixth takes a series and returns a `series float`, which is how you offer a choice of chart data without naming `input.source`. There are no bounds and no step here — for those, use `input.int` or `input.float`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
input(const string defval, const string title, [const string...] options, const string tooltip, const string inline, const string group, const bool confirm, const display display) → input string
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `defval` | `const string` | yes | Default value of the input. The reader can change it from the chart. When `options` is given, `defval` must be one of its values. | | |
| `title` | `const string` | no | Title of the input. If not specified, the title is `Untitled`. If the title is specified but empty, the title is an empty string. | | `"Untitled"` |
| `options` | `[const string...]` | no | List of values the reader can choose from. The value of `defval` must be one of them. | | |
| `tooltip` | `const string` | no | Text of a tooltip shown with the input. | | `""` |
| `inline` | `const string` | no | Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line. | | `""` |
| `group` | `const string` | no | Creates a header above all inputs using the same group argument string. The string is also used as the header's text. | | `""` |
| `confirm` | `const bool` | no | If true, the reader is asked to confirm the value before the script is added to the chart. The default is false. | | `false` |
| `display` | `const display` | no | Where the input's value is shown outside the script's settings, as a `display.*` constant: `display.status_line`, `display.data_window`, `display.all` or `display.none`. Combine constants with `+`. The default is `display.all`. | `display.none`, `display.data_window`, `display.status_line`, `display.all` | `display.all` |

**Returns**

`input string`

**Notes**

* The default `defval` must be a value: `na` is rejected with "Argument `defval` of `input()` cannot be `na`." Any constant expression of type string is accepted, such as `"a" + "b"`.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Customizable Moving Average", overlay=true)
length = input(14, title="SMA Length")
sma_value = talib.sma(close, length)
plot(sma_value, title="SMA", color=color.blue, linewidth=2)
```

## `input` (function, overload 3)

**Definition**

Declares a setting the reader can change from the chart, picking its kind from the type of the default value you hand it.

Six forms exist. Give it a bool and you get a bool back; give it a colour, a float, an int or a string and the same holds. The sixth takes a series and returns a `series float`, which is how you offer a choice of chart data without naming `input.source`. There are no bounds and no step here — for those, use `input.int` or `input.float`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
input(const int defval, const string title, [const int...] options, const string tooltip, const string inline, const string group, const bool confirm, const display display) → input int
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `defval` | `const int` | yes | Default value of the input. The reader can change it from the chart. When `options` is given, `defval` must be one of its values. | | |
| `title` | `const string` | no | Title of the input. If not specified, the title is `Untitled`. If the title is specified but empty, the title is an empty string. | | `"Untitled"` |
| `options` | `[const int...]` | no | List of values the reader can choose from. The value of `defval` must be one of them. | | |
| `tooltip` | `const string` | no | Text of a tooltip shown with the input. | | `""` |
| `inline` | `const string` | no | Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line. | | `""` |
| `group` | `const string` | no | Creates a header above all inputs using the same group argument string. The string is also used as the header's text. | | `""` |
| `confirm` | `const bool` | no | If true, the reader is asked to confirm the value before the script is added to the chart. The default is false. | | `false` |
| `display` | `const display` | no | Where the input's value is shown outside the script's settings, as a `display.*` constant: `display.status_line`, `display.data_window`, `display.all` or `display.none`. Combine constants with `+`. The default is `display.all`. | `display.none`, `display.data_window`, `display.status_line`, `display.all` | `display.all` |

**Returns**

`input int`

**Notes**

* The default `defval` must be a value: `na` is rejected with "Argument `defval` of `input()` cannot be `na`." Any constant expression of type int is accepted, such as `-5` or `2 * 3`.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Customizable Moving Average", overlay=true)
length = input(14, title="SMA Length")
sma_value = talib.sma(close, length)
plot(sma_value, title="SMA", color=color.blue, linewidth=2)
```

## `input` (function, overload 4)

**Definition**

Declares a setting the reader can change from the chart, picking its kind from the type of the default value you hand it.

Six forms exist. Give it a bool and you get a bool back; give it a colour, a float, an int or a string and the same holds. The sixth takes a series and returns a `series float`, which is how you offer a choice of chart data without naming `input.source`. There are no bounds and no step here — for those, use `input.int` or `input.float`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
input(const float defval, const string title, [const float...] options, const string tooltip, const string inline, const string group, const bool confirm, const display display) → input float
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `defval` | `const float` | yes | Default value of the input. The reader can change it from the chart. When `options` is given, `defval` must be one of its values. | | |
| `title` | `const string` | no | Title of the input. If not specified, the title is `Untitled`. If the title is specified but empty, the title is an empty string. | | `"Untitled"` |
| `options` | `[const float...]` | no | List of values the reader can choose from. The value of `defval` must be one of them. | | |
| `tooltip` | `const string` | no | Text of a tooltip shown with the input. | | `""` |
| `inline` | `const string` | no | Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line. | | `""` |
| `group` | `const string` | no | Creates a header above all inputs using the same group argument string. The string is also used as the header's text. | | `""` |
| `confirm` | `const bool` | no | If true, the reader is asked to confirm the value before the script is added to the chart. The default is false. | | `false` |
| `display` | `const display` | no | Where the input's value is shown outside the script's settings, as a `display.*` constant: `display.status_line`, `display.data_window`, `display.all` or `display.none`. Combine constants with `+`. The default is `display.all`. | `display.none`, `display.data_window`, `display.status_line`, `display.all` | `display.all` |

**Returns**

`input float`

**Notes**

* The default `defval` must be a value: `na` is rejected with "Argument `defval` of `input()` cannot be `na`." Any constant expression of type float is accepted, such as `-5.5` or `2.5 * 2`.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Customizable Moving Average", overlay=true)
length = input(14, title="SMA Length")
sma_value = talib.sma(close, length)
plot(sma_value, title="SMA", color=color.blue, linewidth=2)
```

## `input` (function, overload 5)

**Definition**

Declares a setting the reader can change from the chart, picking its kind from the type of the default value you hand it.

Six forms exist. Give it a bool and you get a bool back; give it a colour, a float, an int or a string and the same holds. The sixth takes a series and returns a `series float`, which is how you offer a choice of chart data without naming `input.source`. There are no bounds and no step here — for those, use `input.int` or `input.float`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
input(series float defval, const string title, const string tooltip, const string inline, const string group, const bool confirm, const display display) → series float
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `defval` | `series float` | yes | Default source: a built-in series float variable such as `close` or `hlc3`. The reader can change it from the chart. | | |
| `title` | `const string` | no | Title of the input. If not specified, the title is `Untitled`. If the title is specified but empty, the title is an empty string. | | `"Untitled"` |
| `tooltip` | `const string` | no | Text of a tooltip shown with the input. | | `""` |
| `inline` | `const string` | no | Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line. | | `""` |
| `group` | `const string` | no | Creates a header above all inputs using the same group argument string. The string is also used as the header's text. | | `""` |
| `confirm` | `const bool` | no | If true, the reader is asked to confirm the value before the script is added to the chart. The default is false. | | `false` |
| `display` | `const display` | no | Where the input's value is shown outside the script's settings, as a `display.*` constant: `display.status_line`, `display.data_window`, `display.all` or `display.none`. Combine constants with `+`. The default is `display.all`. | `display.none`, `display.data_window`, `display.status_line`, `display.all` | `display.all` |

**Returns**

`series float`

**Notes**

* The default `defval` must be a value: `na` is rejected with "Argument `defval` of `input()` cannot be `na`." A built-in series such as `close` or `hlc3` is accepted.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Customizable Moving Average", overlay=true)
length = input(14, title="SMA Length")
sma_value = talib.sma(close, length)
plot(sma_value, title="SMA", color=color.blue, linewidth=2)
```

## `input` (function, overload 6)

**Definition**

Declares a setting the reader can change from the chart, picking its kind from the type of the default value you hand it.

Six forms exist. Give it a bool and you get a bool back; give it a colour, a float, an int or a string and the same holds. The sixth takes a series and returns a `series float`, which is how you offer a choice of chart data without naming `input.source`. There are no bounds and no step here — for those, use `input.int` or `input.float`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
input(const bool defval, const string title, const string tooltip, const string inline, const string group, const bool confirm, const display display) → input bool
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `defval` | `const bool` | yes | Default value of the input. The reader can change it from the chart. | | |
| `title` | `const string` | no | Title of the input. If not specified, the title is `Untitled`. If the title is specified but empty, the title is an empty string. | | `"Untitled"` |
| `tooltip` | `const string` | no | Text of a tooltip shown with the input. | | `""` |
| `inline` | `const string` | no | Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line. | | `""` |
| `group` | `const string` | no | Creates a header above all inputs using the same group argument string. The string is also used as the header's text. | | `""` |
| `confirm` | `const bool` | no | If true, the reader is asked to confirm the value before the script is added to the chart. The default is false. | | `false` |
| `display` | `const display` | no | Where the input's value is shown outside the script's settings, as a `display.*` constant: `display.status_line`, `display.data_window`, `display.all` or `display.none`. Combine constants with `+`. The default is `display.none`: the value is shown only in the settings. | `display.none`, `display.data_window`, `display.status_line`, `display.all` | `display.none` |

**Returns**

`input bool`

**Notes**

* The default `defval` must be a value: `na` is rejected with "Argument `defval` of `input()` cannot be `na`." Any constant expression of type bool is accepted, such as `true`.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Customizable Moving Average", overlay=true)
length = input(14, title="SMA Length")
sma_value = talib.sma(close, length)
plot(sma_value, title="SMA", color=color.blue, linewidth=2)
```

## `int` (function, overload 1)

**Definition**

Converts a value to an `int`.

Four overloads, one per form type; the form you pass in is the form you get back. At compile time the argument may be `int` or `float`; floats are truncated toward zero.

**Syntax**

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

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `const float` | yes | Value to convert. Accepts `int` or `float` (truncated toward zero). `na` stays `na`. |

**Returns**

`const int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("int() Example", overlay=true)
// Round down to a whole number, then pass it through int()
int wholeClose = int(math.floor(close))
plot(wholeClose, title="Close Without Decimals", color=color.blue)
```

## `int` (function, overload 2)

**Definition**

Converts a value to an `int`.

Four overloads, one per form type; the form you pass in is the form you get back. At compile time the argument may be `int` or `float`; floats are truncated toward zero.

**Syntax**

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

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `input float` | yes | Value to convert. Accepts `int` or `float` (truncated toward zero). `na` stays `na`. |

**Returns**

`input int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("int() Example", overlay=true)
// Round down to a whole number, then pass it through int()
int wholeClose = int(math.floor(close))
plot(wholeClose, title="Close Without Decimals", color=color.blue)
```

## `int` (function, overload 3)

**Definition**

Converts a value to an `int`.

Four overloads, one per form type; the form you pass in is the form you get back. At compile time the argument may be `int` or `float`; floats are truncated toward zero.

**Syntax**

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

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `simple float` | yes | Value to convert. Accepts `int` or `float` (truncated toward zero). `na` stays `na`. |

**Returns**

`simple int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("int() Example", overlay=true)
// Round down to a whole number, then pass it through int()
int wholeClose = int(math.floor(close))
plot(wholeClose, title="Close Without Decimals", color=color.blue)
```

## `int` (function, overload 4)

**Definition**

Converts a value to an `int`.

Four overloads, one per form type; the form you pass in is the form you get back. At compile time the argument may be `int` or `float`; floats are truncated toward zero.

**Syntax**

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

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `series float` | yes | Value to convert. Accepts `int` or `float` (truncated toward zero). `na` stays `na`. |

**Returns**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("int() Example", overlay=true)
// Round down to a whole number, then pass it through int()
int wholeClose = int(math.floor(close))
plot(wholeClose, title="Close Without Decimals", color=color.blue)
```

## `label` (function)

**Definition**

Converts `value` to the `label` type. It is used almost only as `label(na)`, to declare a label variable that has no drawing yet, so that its type is known before the first drawing is assigned.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
label(series label value) → series label
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `series label` | yes | The value to convert to the specified type, usually na. |

**Returns**

`series label`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("label() Example", overlay=true)
// Keep a single label, moved to the latest bar
static label lbl = label(na)
if barstate.islast {
    if not na(lbl) {
        label.delete(lbl)
    }
    lbl := label.new(bar_index, high, text="Last bar")
}
```

## `line` (function)

**Definition**

Converts `value` to the `line` type. It is used almost only as `line(na)`, to declare a line variable that has no drawing yet, so that its type is known before the first drawing is assigned.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
line(series line value) → series line
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `series line` | yes | The value to convert to the specified type, usually na. |

**Returns**

`series line`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("line() Example", overlay=true)
static line lastLine = line(na)
if barstate.islast {
    lastLine := line.new(bar_index[20], close[20], bar_index, close, color=color.blue)
}
```

## `linefill` (function)

**Definition**

Converts `value` to the `linefill` type. It is used almost only as `linefill(na)`, to declare a linefill variable that has no drawing yet, so that its type is known before the first drawing is assigned.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
linefill(series linefill value) → series linefill
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `series linefill` | yes | The value to convert to the specified type, usually na. |

**Returns**

`series linefill`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("linefill() Example", overlay=true)
static linefill band = linefill(na)
if barstate.islast {
    upper = line.new(bar_index[20], high[20], bar_index, high, color=color.green)
    lower = line.new(bar_index[20], low[20], bar_index, low, color=color.red)
    band := linefill.new(upper, lower, color.new(color.gray, 0.2))
}
```

## `minute` (function)

**Definition**

The minute of a time you supply.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
minute(series int time, series string timezone) → series int
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `time` | `series int` | yes | UNIX time, in milliseconds. | |
| `timezone` | `series string` | no | The time zone the value is read in: an IANA time zone database name (for example "America/New\_York") or "UTC". Unlike `timestamp`, `time` and `str.format_time`, this function does not accept offset notation such as "UTC-5" or "GMT+0530": a name that cannot be loaded gives 0, not `na`. | `syminfo.timezone` |

**Returns**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Minute Function Example", overlay=true)
// Get current bar minute
currentMinute = minute(time)
// Plot minute in Data Window
plot(currentMinute, title="Current Minute")
```

## `month` (function)

**Definition**

The month of a time you supply.

Same arguments as `year`: the time is required and the timezone is optional.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
month(series int time, series string timezone) → series int
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `time` | `series int` | yes | UNIX time, in milliseconds. | |
| `timezone` | `series string` | no | The time zone the value is read in: an IANA time zone database name (for example "America/New\_York") or "UTC". Unlike `timestamp`, `time` and `str.format_time`, this function does not accept offset notation such as "UTC-5" or "GMT+0530": a name that cannot be loaded gives 0, not `na`. | `syminfo.timezone` |

**Returns**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Month Function Example", overlay=true)
// Get current bar month
currentMonth = month(time)
// Plot month in Data Window
plot(currentMonth, title="Current Month")
```

## `na` (function)

**Definition**

Tests whether a value is absent. It takes any type and gives back a bool.

This is the test a script needs often, because so much reads `na` when there is nothing behind it: an instrument property that is unknown, an orderflow figure on a bar with no footprint data, a colour function handed an `na`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
na(series <any_type> value) → series bool
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `series <any_type>` | yes | Value to be tested. |

**Returns**

`series bool`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("NA Example", overlay=true)
val = close > open ? close : na
isNa = na(val)
plot(val, color=color.blue, title="Value (May be NA)")
plot(isNa ? 1 : 0, color=color.red, title="Is NA (1 = True, 0 = False)")
```

## `nz` (function, overload 1)

**Definition**

Takes a value and an alternative of the same type, and stands in for the value where it is absent.

Five overloads, one per data type. The alternative is optional. When it is left out, `nz` uses 0 for an int or a float, an empty string for a string, false for a bool and `#483D8B` for a color.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
nz(series int value, series int alt) → series int
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `value` | `series int` | yes | The value to check. | |
| `alt` | `series int` | no | The alternative to use in its place. Optional, and of the same type as `value`. | `0` |

**Returns**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("nz Example", overlay=false)
// On the first bar close[1] is na: use the current close instead
prevClose = nz(close[1], close)
plot(close - prevClose, title="Change", color=color.blue)
```

## `nz` (function, overload 2)

**Definition**

Takes a value and an alternative of the same type, and stands in for the value where it is absent.

Five overloads, one per data type. The alternative is optional. When it is left out, `nz` uses 0 for an int or a float, an empty string for a string, false for a bool and `#483D8B` for a color.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
nz(series float value, series float alt) → series float
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `value` | `series float` | yes | The value to check. | |
| `alt` | `series float` | no | The alternative to use in its place. Optional, and of the same type as `value`. | `0` |

**Returns**

`series float`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("nz Example", overlay=false)
// On the first bar close[1] is na: use the current close instead
prevClose = nz(close[1], close)
plot(close - prevClose, title="Change", color=color.blue)
```

## `nz` (function, overload 3)

**Definition**

Takes a value and an alternative of the same type, and stands in for the value where it is absent.

Five overloads, one per data type. The alternative is optional. When it is left out, `nz` uses 0 for an int or a float, an empty string for a string, false for a bool and `#483D8B` for a color.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
nz(series string value, series string alt) → series string
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `value` | `series string` | yes | The value to check. | |
| `alt` | `series string` | no | The alternative to use in its place. Optional, and of the same type as `value`. | `""` |

**Returns**

`series string`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("nz Example", overlay=false)
// On the first bar close[1] is na: use the current close instead
prevClose = nz(close[1], close)
plot(close - prevClose, title="Change", color=color.blue)
```

## `nz` (function, overload 4)

**Definition**

Takes a value and an alternative of the same type, and stands in for the value where it is absent.

Five overloads, one per data type. The alternative is optional. When it is left out, `nz` uses 0 for an int or a float, an empty string for a string, false for a bool and `#483D8B` for a color.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
nz(series bool value, series bool alt) → series bool
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `value` | `series bool` | yes | The value to check. | |
| `alt` | `series bool` | no | The alternative to use in its place. Optional, and of the same type as `value`. | `false` |

**Returns**

`series bool`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("nz Example", overlay=false)
// On the first bar close[1] is na: use the current close instead
prevClose = nz(close[1], close)
plot(close - prevClose, title="Change", color=color.blue)
```

## `nz` (function, overload 5)

**Definition**

Takes a value and an alternative of the same type, and stands in for the value where it is absent.

Five overloads, one per data type. The alternative is optional. When it is left out, `nz` uses 0 for an int or a float, an empty string for a string, false for a bool and `#483D8B` for a color.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
nz(series color value, series color alt) → series color
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `value` | `series color` | yes | The value to check. | |
| `alt` | `series color` | no | The alternative to use in its place. Optional, and of the same type as `value`. | `#483D8B` |

**Returns**

`series color`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("nz Example", overlay=false)
// On the first bar close[1] is na: use the current close instead
prevClose = nz(close[1], close)
plot(close - prevClose, title="Change", color=color.blue)
```

## `plot` (function)

**Definition**

Draws a series on the chart, one point per bar. It is the output function you will reach for first.

Eleven parameters, of which only the first is required — every other one carries a default. The call has to sit at the top level of the script: put it inside a branch, a loop or a function of your own and the script is rejected for not being in the global scope. A condition therefore belongs in the `color` argument, not around the call.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
plot(series float series, const string title, series color color, input int linewidth, input plotStyle style, input bool trackprice, input float histbase, input int offset, const bool force_overlay, input display display, input string format) → series plot
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `series` | `series float` | yes | Series of data to be plotted. Required argument. | | |
| `title` | `const string` | no | Title of the plot. | | `na` |
| `color` | `series color` | no | Color of the plot. You can use constants like 'color=color.red' or 'color=#ff001a' as well as complex expressions like 'color = close >= open ? color.green : color.red'. Optional argument. | | `na` |
| `linewidth` | `input int` | no | Width of the plotted line. Default value is 1. Not applicable to every style. | | `1` |
| `style` | `input plotStyle` | no | Type of plot. Possible values are: plotStyle.line, plotStyle.linebr, plotStyle.area, plotStyle.areabr, plotStyle.smoothedArea, plotStyle.stepLine, plotStyle.stepLinebr, plotStyle.stepArea, plotStyle.stepAreabr, plotStyle.bar, plotStyle.histogram, plotStyle.scatter, plotStyle.triangular, plotStyle.cross. Default value is plotStyle.line. | `plotStyle.line`, `plotStyle.linebr`, `plotStyle.area`, `plotStyle.areabr`, `plotStyle.smoothedArea`, `plotStyle.stepLine`, `plotStyle.stepLinebr`, `plotStyle.stepArea`, `plotStyle.stepAreabr`, `plotStyle.bar`, `plotStyle.histogram`, `plotStyle.scatter`, `plotStyle.triangular`, `plotStyle.cross` | `plotStyle.line` |
| `trackprice` | `input bool` | no | Accepted, but the current compiler does not use it, so it has no effect: no price line is drawn. Default is false. | | `false` |
| `histbase` | `input float` | no | The price value used as the reference level when rendering the plot with the plotStyle.histogram or plotStyle.area style. Default is 0.0. | | `0.0` |
| `offset` | `input int` | no | Shifts the plot to the left or to the right on the given number of bars. Default is 0. | | `0` |
| `force_overlay` | `const bool` | no | If true, the plotted results will display on the main chart pane, even when the script occupies a separate pane. Optional. The default is false. | | `false` |
| `display` | `input display` | no | Controls where the plot is shown (pane, price scale, status line, data window). Use display.\* constants; combine with +. Default is display.all. | `display.none`, `display.pane`, `display.data_window`, `display.price_scale`, `display.status_line`, `display.all` | `display.all` |
| `format` | `input string` | no | Format of the displayed values: `format.price`, `format.percent` or `format.volume`. The default is an empty string, which uses the script's format. `format.inherit` and `format.mintick` pass the editor's check but are refused when the script is added to the chart. | `format.percent`, `format.price`, `format.volume` | `""` |

**Returns**

`series plot`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Conditional Plot", overlay=true)
signal = close > talib.sma(close, 14) ? close : na
plot(signal, color=color.green, title="Above SMA Signal", style=plotStyle.scatter)
```

## `plotarrow` (function)

**Definition**

Draws an arrow on each bar, sized from a number you supply.

It is the odd one out among the markers: `plotshape` and `plotchar` take a condition, this takes a value. It also has no location, no shape, no size and no text — where an arrow sits follows from the number.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
plotarrow(series float series, const string title, series color colorup, series color colordown, input int offset, input int minheight, input int maxheight, const bool force_overlay, input display display, input string format) → void
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `series` | `series float` | yes | Series of data to be plotted as arrows. Required argument. | | |
| `title` | `const string` | no | Title of the plot. | | `na` |
| `colorup` | `series color` | no | Color of the up arrows. Optional argument. | | `na` |
| `colordown` | `series color` | no | Color of the down arrows. Optional argument. | | `na` |
| `offset` | `input int` | no | Shifts arrows to the left or to the right on the given number of bars. Default is 0. | | `0` |
| `minheight` | `input int` | no | Minimal possible arrow height in pixels. Default is 10. | | `10` |
| `maxheight` | `input int` | no | Maximum possible arrow height in pixels. Default is 100. | | `100` |
| `force_overlay` | `const bool` | no | If true, the plotted results will display on the main chart pane, even when the script occupies a separate pane. Optional. The default is false. | | `false` |
| `display` | `input display` | no | Controls where the plot is shown (pane, price scale, status line, data window). Use display.\* constants; combine with +. Default is display.all. | `display.none`, `display.pane`, `display.data_window`, `display.price_scale`, `display.status_line`, `display.all` | `display.all` |
| `format` | `input string` | no | Format of the displayed values: `format.price`, `format.percent` or `format.volume`. The default is an empty string, which uses the script's format. `format.inherit` and `format.mintick` pass the editor's check but are refused when the script is added to the chart. | `format.percent`, `format.price`, `format.volume` | `""` |

**Returns**

`void`

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Plot Arrow Example", overlay=true)
longCondition = talib.crossover(talib.sma(close, 10), talib.sma(close, 20))
shortCondition = talib.crossunder(talib.sma(close, 10), talib.sma(close, 20))
plotarrow(longCondition ? 1 : shortCondition ? -1 : na, title="Arrow Signals", colorup=color.lime, colordown=color.red,offset=-1)
```

## `plotbar` (function)

**Definition**

Draws bars from the same four required series that `plotcandle` takes.

The difference is the colouring: one colour for the whole bar, with no separate wick or border. Neither function has an offset parameter at all.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
plotbar(series float open, series float high, series float low, series float close, const string title, series color color, input display display, const bool force_overlay) → void
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `open` | `series float` | yes | Open series of data to be used as open values of bars. Required argument. | | |
| `high` | `series float` | yes | High series of data to be used as high values of bars. Required argument. | | |
| `low` | `series float` | yes | Low series of data to be used as low values of bars. Required argument. | | |
| `close` | `series float` | yes | Close series of data to be used as close values of bars. Required argument. | | |
| `title` | `const string` | no | Title of the plotbar. Optional argument. | | `na` |
| `color` | `series color` | no | Color of the ohlc bars. You can use constants like 'color=color.blue' or 'color=#0000FF' as well as complex expressions like 'color = close >= open ? color.yellow : color.black'. Optional argument. | | `na` |
| `display` | `input display` | no | Where the bars are shown: `display.pane`, `display.price_scale`, `display.status_line`, `display.data_window`, `display.all` (the default) or `display.none`. Combine constants with `+`, for example `display.pane + display.status_line`. | `display.none`, `display.pane`, `display.data_window`, `display.price_scale`, `display.status_line`, `display.all` | `display.all` |
| `force_overlay` | `const bool` | no | If true, the plotted results will display on the main chart pane, even when the script occupies a separate pane. Optional. The default is false. | | `false` |

**Returns**

`void`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Custom Bars Example", overlay=true)
customOpen = open + talib.sma(close, 5) * 0.001
customHigh = high + talib.sma(close, 5) * 0.001
customLow = low - talib.sma(close, 5) * 0.001
customClose = close + talib.sma(close, 5) * 0.001
plotbar(customOpen, customHigh, customLow, customClose, title="Custom Bars")
```

## `plotcandle` (function)

**Definition**

Draws candles from four series of your own rather than from the chart's bars.

All four price series are required. The body, the wick and the border take separate colours, and each of the three is series-form.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
plotcandle(series float open, series float high, series float low, series float close, const string title, series color color, series color wickcolor, series color bordercolor, const bool force_overlay, input display display) → void
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `open` | `series float` | yes | Open series of data to be used as open values of candles. Required argument. | | |
| `high` | `series float` | yes | High series of data to be used as high values of candles. Required argument. | | |
| `low` | `series float` | yes | Low series of data to be used as low values of candles. Required argument. | | |
| `close` | `series float` | yes | Close series of data to be used as close values of candles. Required argument. | | |
| `title` | `const string` | no | Title of the plotcandles. Optional argument | | `na` |
| `color` | `series color` | no | Color of the candles. You can use constants like 'color=color.red' or 'color=#ff001a' as well as complex expressions like 'color = close >= open ? color.green : color.red'. Optional argument. | | `na` |
| `wickcolor` | `series color` | no | The color of the wick of candles. An optional argument. | | `na` |
| `bordercolor` | `series color` | no | The border color of candles. An optional argument. | | `na` |
| `force_overlay` | `const bool` | no | If true, the plotted results will display on the main chart pane, even when the script occupies a separate pane. Optional. The default is false. | | `false` |
| `display` | `input display` | no | Where the candles are shown: `display.pane`, `display.price_scale`, `display.status_line`, `display.data_window`, `display.all` (the default) or `display.none`. Combine constants with `+`, for example `display.pane + display.status_line`. | `display.none`, `display.pane`, `display.data_window`, `display.price_scale`, `display.status_line`, `display.all` | `display.all` |

**Returns**

`void`

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Plot Candle Example", overlay=true)
openSeries = open
highSeries = high + talib.sma(close, 5) * 0.001
lowSeries = low - talib.sma(close, 5) * 0.001
closeSeries = close + talib.sma(close, 5) * 0.001
upColor = color.new(color.green, 0)
downColor = color.new(color.red, 0)
wickColor = color.new(color.gray, 0)
plotcandle(openSeries, highSeries, lowSeries, closeSeries, title="Custom Candles", color=closeSeries >= openSeries ? upColor : downColor, wickcolor=wickColor)
```

## `plotchar` (function, overload 1)

**Definition**

The same marker as `plotshape`, with one character in place of a shape from the fixed set.

It draws exactly one character. Pass a longer string and it is cut to the first character, with no warning and no error, so pass the character you want.

`series` is a float price, and the marker is declared to the chart as absolute-position whatever `location` is passed. With a `location` other than `location.absolute` the call is still accepted and the value is read as a condition (non-zero is true); how the chart places such a marker is not established.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
plotchar(series float series, const string title, const string char, input location location, series color color, input int offset, const string text, series color textcolor, input size size, const bool force_overlay, input display display, input string format) → void
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `series` | `series float` | yes | The price at which to place the marker: a float series. Required argument. | | |
| `title` | `const string` | no | Title of the plot. | | `na` |
| `char` | `const string` | no | Character to use as a visual shape. | | `na` |
| `location` | `input location` | no | Location of shapes on the chart. Possible values are: location.abovebar, location.belowbar, location.top, location.bottom, location.absolute. Default value is location.absolute. | `location.abovebar`, `location.belowbar`, `location.top`, `location.bottom`, `location.absolute` | `location.absolute` |
| `color` | `series color` | no | Color of the characters. You can use constants like 'color=color.red' or 'color=#ff001a' as well as complex expressions like 'color = close >= open ? color.green : color.red'. Optional argument. | | `na` |
| `offset` | `input int` | no | Shifts shapes to the left or to the right on the given number of bars. Default is 0. | | `0` |
| `text` | `const string` | no | Text to display with the shape. The compiler keeps a `\n` written in the string as the two characters backslash and `n` and does not turn it into a line break; whether the chart draws a line break for it is not established. | | `na` |
| `textcolor` | `series color` | no | Color of the character text. Optional argument. | | `na` |
| `size` | `input size` | no | Size of characters on the chart. Possible values are: size.auto, size.tiny, size.small, size.normal, size.large, size.huge. Default is size.auto. | `size.auto`, `size.tiny`, `size.small`, `size.normal`, `size.large`, `size.huge` | `size.auto` |
| `force_overlay` | `const bool` | no | If true, the plotted results will display on the main chart pane, even when the script occupies a separate pane. Optional. The default is false. | | `false` |
| `display` | `input display` | no | Controls where the plot is shown (pane, price scale, status line, data window). Use display.\* constants; combine with +. Default is display.all. | `display.none`, `display.pane`, `display.data_window`, `display.price_scale`, `display.status_line`, `display.all` | `display.all` |
| `format` | `input string` | no | Format of the plotted value: `format.price`, `format.percent` or `format.volume`. The default is an empty string, which uses the script's format. Any other value passes the editor's check but is refused when the script is added to the chart. | `format.percent`, `format.price`, `format.volume` | `""` |

**Returns**

`void`

**Notes**

* The `size` argument takes a `size.*` constant. A string such as "small" still compiles here, with a deprecation warning: write the constant. A string that is not a size name, such as "giant", stops the compiler with the error "internal validator error".

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("PlotChar Example", overlay=true)
conditionUp = close > close[1]
conditionDown = close < close[1]
plotchar(conditionUp, char='▲', location=location.abovebar, size=size.small, color=color.green)
plotchar(conditionDown, char='▼', location=location.belowbar, size=size.small, color=color.red)
```

## `plotchar` (function, overload 2)

**Definition**

The same marker as `plotshape`, with one character in place of a shape from the fixed set.

It draws exactly one character. Pass a longer string and it is cut to the first character, with no warning and no error, so pass the character you want.

`series` is a boolean condition. With `location.absolute` the call is also accepted: the value handed to the chart is 1 where the condition is true and 0 where it is false, so the marker is placed at the price 1 or 0, which is rarely wanted; use a float series for an absolute position.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
plotchar(series bool series, const string title, const string char, input location location, series color color, input int offset, const string text, series color textcolor, input size size, const bool force_overlay, input display display, input string format) → void
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `series` | `series bool` | yes | The condition to mark: a bool series. Required argument. | | |
| `title` | `const string` | no | Title of the plot. | | `na` |
| `char` | `const string` | no | Character to use as a visual shape. | | `na` |
| `location` | `input location` | no | Location of shapes on the chart. Possible values are: location.abovebar, location.belowbar, location.top, location.bottom, location.absolute. Default value is location.abovebar. | `location.abovebar`, `location.belowbar`, `location.top`, `location.bottom`, `location.absolute` | `location.abovebar` |
| `color` | `series color` | no | Color of the characters. You can use constants like 'color=color.red' or 'color=#ff001a' as well as complex expressions like 'color = close >= open ? color.green : color.red'. Optional argument. | | `na` |
| `offset` | `input int` | no | Shifts shapes to the left or to the right on the given number of bars. Default is 0. | | `0` |
| `text` | `const string` | no | Text to display with the shape. The compiler keeps a `\n` written in the string as the two characters backslash and `n` and does not turn it into a line break; whether the chart draws a line break for it is not established. | | `na` |
| `textcolor` | `series color` | no | Color of the character text. Optional argument. | | `na` |
| `size` | `input size` | no | Size of characters on the chart. Possible values are: size.auto, size.tiny, size.small, size.normal, size.large, size.huge. Default is size.auto. | `size.auto`, `size.tiny`, `size.small`, `size.normal`, `size.large`, `size.huge` | `size.auto` |
| `force_overlay` | `const bool` | no | If true, the plotted results will display on the main chart pane, even when the script occupies a separate pane. Optional. The default is false. | | `false` |
| `display` | `input display` | no | Controls where the plot is shown (pane, price scale, status line, data window). Use display.\* constants; combine with +. Default is display.all. | `display.none`, `display.pane`, `display.data_window`, `display.price_scale`, `display.status_line`, `display.all` | `display.all` |
| `format` | `input string` | no | Format of the plotted value: `format.price`, `format.percent` or `format.volume`. The default is an empty string, which uses the script's format. Any other value passes the editor's check but is refused when the script is added to the chart. | `format.percent`, `format.price`, `format.volume` | `""` |

**Returns**

`void`

**Notes**

* The `size` argument takes a `size.*` constant. A string such as "small" still compiles here, with a deprecation warning: write the constant.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("PlotChar Example", overlay=true)
conditionUp = close > close[1]
conditionDown = close < close[1]
plotchar(conditionUp, char='▲', location=location.abovebar, size=size.small, color=color.green)
plotchar(conditionDown, char='▼', location=location.belowbar, size=size.small, color=color.red)
```

## `plotshape` (function, overload 1)

**Definition**

Marks the bars on which a condition holds, using a shape from a fixed set.

The condition is the first argument, which is how you mark some bars and not others without moving the call: like every chart-output function it must be called at the top level.

`series` is a boolean condition. With `location.absolute` the call is also accepted: the value handed to the chart is 1 where the condition is true and 0 where it is false, so the marker is placed at the price 1 or 0, which is rarely wanted; use a float series for an absolute position.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
plotshape(series bool series, const string title, input shape shape, input location location, series color color, input int offset, const string text, series color textcolor, input size size, const bool force_overlay, input display display, input string format) → void
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `series` | `series bool` | yes | The condition to mark: a bool series. Required argument. | | |
| `title` | `const string` | no | Title of the plot. | | `na` |
| `shape` | `input shape` | no | Type of plot. Possible values are: shape.xcross, shape.cross, shape.triangleup, shape.triangledown, shape.flag, shape.circle, shape.arrowup, shape.arrowdown, shape.labelup, shape.labeldown, shape.square, shape.diamond. Default value is shape.xcross. | `shape.xcross`, `shape.cross`, `shape.triangleup`, `shape.triangledown`, `shape.flag`, `shape.circle`, `shape.arrowup`, `shape.arrowdown`, `shape.labelup`, `shape.labeldown`, `shape.square`, `shape.diamond` | `shape.xcross` |
| `location` | `input location` | no | Location of shapes on the chart. Possible values are: location.abovebar, location.belowbar, location.top, location.bottom, location.absolute. Default value is location.abovebar. | `location.abovebar`, `location.belowbar`, `location.top`, `location.bottom`, `location.absolute` | `location.abovebar` |
| `color` | `series color` | no | Color of the shapes. You can use constants like 'color=color.red' or 'color=#ff001a' as well as complex expressions like 'color = close >= open ? color.green : color.red'. Optional argument. | | `na` |
| `offset` | `input int` | no | Shifts shapes to the left or to the right on the given number of bars. Default is 0. | | `0` |
| `text` | `const string` | no | Text to display with the shape. The compiler keeps a `\n` written in the string as the two characters backslash and `n` and does not turn it into a line break; whether the chart draws a line break for it is not established. | | `na` |
| `textcolor` | `series color` | no | Color of the shape label text. Optional argument. | | `na` |
| `size` | `input size` | no | Size of shapes on the chart. Possible values are: size.auto, size.tiny, size.small, size.normal, size.large, size.huge. Default is size.auto. | `size.auto`, `size.tiny`, `size.small`, `size.normal`, `size.large`, `size.huge` | `size.auto` |
| `force_overlay` | `const bool` | no | If true, the plotted results will display on the main chart pane, even when the script occupies a separate pane. Optional. The default is false. | | `false` |
| `display` | `input display` | no | Controls where the plot is shown (pane, price scale, status line, data window). Use display.\* constants; combine with +. Default is display.all. | `display.none`, `display.pane`, `display.data_window`, `display.price_scale`, `display.status_line`, `display.all` | `display.all` |
| `format` | `input string` | no | Format of the plotted value: `format.price`, `format.percent` or `format.volume`. The default is an empty string, which uses the script's format. Any other value passes the editor's check but is refused when the script is added to the chart. | `format.percent`, `format.price`, `format.volume` | `""` |

**Returns**

`void`

**Notes**

* The `size` argument takes a `size.*` constant. A string such as "small" still compiles here, with a deprecation warning: write the constant.

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("PlotShape Example", overlay=true)
buySignal = talib.crossover(talib.sma(close, 10), talib.sma(close, 20))
sellSignal = talib.crossunder(talib.sma(close, 10), talib.sma(close, 20)) 
plotshape(series=buySignal, location=location.belowbar, shape=shape.triangleup, color=color.green, size=size.small, title="Buy Signal")
plotshape(series=sellSignal, location=location.abovebar, shape=shape.triangledown, color=color.red, size=size.small, title="Sell Signal")
```

## `plotshape` (function, overload 2)

**Definition**

Marks the bars on which a condition holds, using a shape from a fixed set.

The condition is the first argument, which is how you mark some bars and not others without moving the call: like every chart-output function it must be called at the top level.

`series` is a float price, and the marker is declared to the chart as absolute-position whatever `location` is passed. With a `location` other than `location.absolute` the call is still accepted and the value is read as a condition (non-zero is true); how the chart places such a marker is not established.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
plotshape(series float series, const string title, input shape shape, input location location, series color color, input int offset, const string text, series color textcolor, input size size, const bool force_overlay, input display display, input string format) → void
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `series` | `series float` | yes | The price at which to place the marker: a float series. Required argument. | | |
| `title` | `const string` | no | Title of the plot. | | `na` |
| `shape` | `input shape` | no | Type of plot. Possible values are: shape.xcross, shape.cross, shape.triangleup, shape.triangledown, shape.flag, shape.circle, shape.arrowup, shape.arrowdown, shape.labelup, shape.labeldown, shape.square, shape.diamond. Default value is shape.xcross. | `shape.xcross`, `shape.cross`, `shape.triangleup`, `shape.triangledown`, `shape.flag`, `shape.circle`, `shape.arrowup`, `shape.arrowdown`, `shape.labelup`, `shape.labeldown`, `shape.square`, `shape.diamond` | `shape.xcross` |
| `location` | `input location` | no | Location of shapes on the chart. Possible values are: location.abovebar, location.belowbar, location.top, location.bottom, location.absolute. Default value is location.absolute. | `location.abovebar`, `location.belowbar`, `location.top`, `location.bottom`, `location.absolute` | `location.absolute` |
| `color` | `series color` | no | Color of the shapes. You can use constants like 'color=color.red' or 'color=#ff001a' as well as complex expressions like 'color = close >= open ? color.green : color.red'. Optional argument. | | `na` |
| `offset` | `input int` | no | Shifts shapes to the left or to the right on the given number of bars. Default is 0. | | `0` |
| `text` | `const string` | no | Text to display with the shape. The compiler keeps a `\n` written in the string as the two characters backslash and `n` and does not turn it into a line break; whether the chart draws a line break for it is not established. | | `na` |
| `textcolor` | `series color` | no | Color of the shape label text. Optional argument. | | `na` |
| `size` | `input size` | no | Size of shapes on the chart. Possible values are: size.auto, size.tiny, size.small, size.normal, size.large, size.huge. Default is size.auto. | `size.auto`, `size.tiny`, `size.small`, `size.normal`, `size.large`, `size.huge` | `size.auto` |
| `force_overlay` | `const bool` | no | If true, the plotted results will display on the main chart pane, even when the script occupies a separate pane. Optional. The default is false. | | `false` |
| `display` | `input display` | no | Controls where the plot is shown (pane, price scale, status line, data window). Use display.\* constants; combine with +. Default is display.all. | `display.none`, `display.pane`, `display.data_window`, `display.price_scale`, `display.status_line`, `display.all` | `display.all` |
| `format` | `input string` | no | Format of the plotted value: `format.price`, `format.percent` or `format.volume`. The default is an empty string, which uses the script's format. Any other value passes the editor's check but is refused when the script is added to the chart. | `format.percent`, `format.price`, `format.volume` | `""` |

**Returns**

`void`

**Notes**

* The `size` argument takes a `size.*` constant. A string such as "small" still compiles here, with a deprecation warning: write the constant.

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("PlotShape Example", overlay=true)
buySignal = talib.crossover(talib.sma(close, 10), talib.sma(close, 20))
sellSignal = talib.crossunder(talib.sma(close, 10), talib.sma(close, 20)) 
plotshape(series=buySignal, location=location.belowbar, shape=shape.triangleup, color=color.green, size=size.small, title="Buy Signal")
plotshape(series=sellSignal, location=location.abovebar, shape=shape.triangledown, color=color.red, size=size.small, title="Sell Signal")
```

## `polyline` (function)

**Definition**

Converts `value` to the `polyline` type. It is used almost only as `polyline(na)`, to declare a polyline variable that has no drawing yet, so that its type is known before the first drawing is assigned.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
polyline(series polyline value) → series polyline
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `series polyline` | yes | The value to convert to the specified type, usually na. |

**Returns**

`series polyline`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("polyline() Example", overlay=true)
static polyline path = polyline(na)
if barstate.islast {
    pts = array.new<chartPoint>(0)
    array.push(pts, chartPoint.from_index(bar_index[10], close[10]))
    array.push(pts, chartPoint.from_index(bar_index, close))
    path := polyline.new(pts, line_color=color.orange)
}
```

## `second` (function)

**Definition**

The second of a time you supply.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
second(series int time, series string timezone) → series int
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `time` | `series int` | yes | UNIX time, in milliseconds. | |
| `timezone` | `series string` | no | The time zone the value is read in: an IANA time zone database name (for example "America/New\_York") or "UTC". Unlike `timestamp`, `time` and `str.format_time`, this function does not accept offset notation such as "UTC-5" or "GMT+0530": a name that cannot be loaded gives 0, not `na`. | `syminfo.timezone` |

**Returns**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Second Function Example", overlay=true)
// Get current bar second
currentSecond = second(time)
// Plot second in Data Window
plot(currentSecond, title="Current Second")
```

## `strategy` (function)

**Definition**

Declares the script as a strategy: a script that places simulated orders and reports their performance. It is used in place of `indicator`, as the first statement of the script.

Besides the display settings it shares with `indicator`, it sets how orders are sized and filled: `initial_capital`, `default_qty_type` and `default_qty_value` for position size, `commission_type` and `commission_value` for costs, `pyramiding` for how many entries in the same direction are allowed, and `process_orders_on_close`, `calc_on_order_fills` and `calc_on_every_tick` for when orders are evaluated.

**Syntax**

> [!WARNING]
>
> GoCharting is a charting and analytics tool. This is not investment advice. Trading and investing carry a high risk of loss and are not suitable for everyone. You can lose some or all of your money.

```
strategy(const string title, const string shorttitle, const bool overlay, const string format, const int precision, const scale scale, const int pyramiding, const bool calc_on_order_fills, const bool calc_on_every_tick, const string default_qty_type, const float default_qty_value, const float initial_capital, const string commission_type, const float commission_value, const bool process_orders_on_close, const int max_lines_count, const int max_labels_count, const int max_boxes_count, const int max_polylines_count, const bool behind_chart) → void
```

**Parameters**

| Name | Type | Required | Description | Values | Default |
| - | - | - | - | - | - |
| `title` | `const string` | yes | Strategy name shown in the UI and used as the default publication title. | | |
| `shorttitle` | `const string` | no | Short name shown on the chart when set; otherwise `title` is used. | | |
| `overlay` | `const bool` | no | If true, the strategy is drawn over the price chart; otherwise it uses a separate pane. Default is false. | | `false` |
| `format` | `const string` | no | How the script's values are formatted on the price scale and in the status line: `format.inherit` (the default: as the chart's symbol), `format.price`, `format.volume` or `format.percent`. Any other `format.*` constant passes the editor's check but is refused when the script is added to the chart. | `format.inherit`, `format.percent`, `format.price`, `format.volume` | `format.inherit` |
| `precision` | `const int` | no | Number of digits after the decimal point in the script's displayed values. Accepted, but the current compiler does not pass it on, so it has no effect yet. | | `0` |
| `scale` | `const scale` | no | Which price scale the strategy uses: `scale.left`, `scale.right`, or `scale.none`. Optional. Default is `scale.none`. | | `scale.none` |
| `pyramiding` | `const int` | no | Maximum number of entries allowed in the same direction (0 disables adding to a position). An entry that would add to a position that already holds that many open entries in its direction is ignored, with no error. With 0 the first entry from a flat position still opens, so 0 and 1 behave alike. | | `1` |
| `calc_on_order_fills` | `const bool` | no | If true, the strategy recalculates when an order fills. Optional. | | `false` |
| `calc_on_every_tick` | `const bool` | no | If true, the strategy recalculates on every realtime tick of the last bar. Optional. | | `false` |
| `default_qty_type` | `const string` | no | How `default_qty_value` is read when an order gives no `qty`: `strategy.fixed` (the default: a number of contracts), the string "cash" (an amount of money, divided by the order's price) or the string "percent\_of\_equity" (a percentage of the current equity, divided by the order's price). "cash" and "percent\_of\_equity" need a price: an order with a `limit` or `stop` uses that price, but a market `strategy.entry` or `strategy.order`, and a `strategy.exit` without `qty`, stop the script with the error "Invalid order quantity". Only `strategy.fixed` works for market orders. The constants `strategy.cash` and `strategy.percent_of_equity` do not exist: pass the strings. | `strategy.fixed`, `"cash"`, `"percent_of_equity"` | `strategy.fixed` |
| `default_qty_value` | `const float` | no | Default order size used with `default_qty_type`. | | `1` |
| `initial_capital` | `const float` | no | Starting equity for the simulation. | | `1000000` |
| `commission_type` | `const string` | no | How commission is charged: `strategy.commission_percent` (a percentage of each order's value), `strategy.commission_cash_per_order` (a fixed amount for each trade opened and for each trade closed) or `strategy.commission_cash_per_contract` (an amount per contract traded). | `strategy.commission_cash_per_contract`, `strategy.commission_cash_per_order`, `strategy.commission_percent` | `strategy.commission_percent` |
| `commission_value` | `const float` | no | Commission amount according to `commission_type`. | | `0` |
| `process_orders_on_close` | `const bool` | no | If true, orders are processed on bar close instead of on the next bar open. | | `false` |
| `max_lines_count` | `const int` | no | Maximum line drawings allowed. Default is 50. | | `50` |
| `max_labels_count` | `const int` | no | Maximum label drawings allowed. Default is 50. | | `50` |
| `max_boxes_count` | `const int` | no | Maximum box drawings allowed. Default is 50. | | `50` |
| `max_polylines_count` | `const int` | no | Maximum polyline drawings allowed. Default is 50. | | `50` |
| `behind_chart` | `const bool` | no | If true, plot drawings render behind the chart candles. Optional. Default is true. | | `true` |

**Returns**

`void`

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
strategy("MA Cross Strategy", overlay=true, initial_capital=10000, default_qty_type=strategy.fixed, default_qty_value=1, commission_type=strategy.commission_percent, commission_value=0.1)
fast = talib.sma(close, 10)
slow = talib.sma(close, 30)
if talib.crossover(fast, slow) {
    strategy.entry("Long", strategy.long)
}
if talib.crossunder(fast, slow) {
    strategy.close("Long")
}
plot(fast, title="Fast MA", color=color.green)
plot(slow, title="Slow MA", color=color.red)
```

## `string` (function, overload 1)

**Definition**

Converts a value to a string.

It accepts a string only, so it changes the form and not the data type. To render a number as text, look to the `str` namespace.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
string(const string value) → const string
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `const string` | yes | The value to convert to the specified type, usually na. |

**Returns**

`const string`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("String Upper Example", overlay=false)
lowerStr = "gocharting"
upperStr = str.upper(lowerStr)
plot(close, title=upperStr)
```

## `string` (function, overload 2)

**Definition**

Converts a value to a string.

It accepts a string only, so it changes the form and not the data type. To render a number as text, look to the `str` namespace.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
string(input string value) → input string
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `input string` | yes | The value to convert to the specified type, usually na. |

**Returns**

`input string`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("String Upper Example", overlay=false)
lowerStr = "gocharting"
upperStr = str.upper(lowerStr)
plot(close, title=upperStr)
```

## `string` (function, overload 3)

**Definition**

Converts a value to a string.

It accepts a string only, so it changes the form and not the data type. To render a number as text, look to the `str` namespace.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
string(simple string value) → simple string
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `simple string` | yes | The value to convert to the specified type, usually na. |

**Returns**

`simple string`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("String Upper Example", overlay=false)
lowerStr = "gocharting"
upperStr = str.upper(lowerStr)
plot(close, title=upperStr)
```

## `string` (function, overload 4)

**Definition**

Converts a value to a string.

It accepts a string only, so it changes the form and not the data type. To render a number as text, look to the `str` namespace.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
string(series string value) → series string
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `series string` | yes | The value to convert to the specified type, usually na. |

**Returns**

`series string`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("String Upper Example", overlay=false)
lowerStr = "gocharting"
upperStr = str.upper(lowerStr)
plot(close, title=upperStr)
```

## `table` (function)

**Definition**

Converts `value` to the `table` type. It is used almost only as `table(na)`, to declare a table variable that has no drawing yet, so that its type is known before the first drawing is assigned.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
table(series table value) → series table
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `value` | `series table` | yes | The value to convert to the specified type, usually na. |

**Returns**

`series table`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("table() Example", overlay=true)
static table info = table(na)
if barstate.islast {
    info := table.new(position.top_right, 1, 1, bgcolor=color.gray)
    table.cell(info, 0, 0, text="Bars: " + str.tostring(bar_index + 1))
}
```

## `time` (function, overload 1)

**Definition**

Returns the opening time of the current bar in UNIX milliseconds, measured on `interval` rather than on the chart's own bars.

With `session`, it returns `na` when the opening time of the `interval` bar is outside that session. The session is tested against the start of the `interval` bar, not against the opening time of the chart bar: with `interval` "1D" the tested time is the start of the day, so a session that does not contain midnight, such as "0930-1600", gives `na` on every bar of an intraday chart. Interval bars are cut on the clock in that time zone, not aligned to the chart's bars: with `interval` "1h", a chart bar opening at 09:30 is tested as 09:00, so an `interval` equal to the chart's own interval tests the chart bar's own time only when the chart's bars start on those clock boundaries. `timezone` sets the time zone the interval and the session are read in. `bars_back` and `interval_bars_back` look back a number of chart bars or interval bars respectively.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
time(series string interval, series string session, series int bars_back, series int interval_bars_back) → series int
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `interval` | `series string` | no | The interval the time is measured on: a count and a unit, such as "15m", "4h" or "1D", with the units `s`, `m`, `h`, `D`, `W` and `M`. For `D`, `W` and `M` the count must be 1. Any other string compiles and gives `na`. | `interval.interval` |
| `session` | `series string` | no | A session. Bars outside it return `na`. | `""` |
| `bars_back` | `series int` | no | Number of chart bars to look back. | `0` |
| `interval_bars_back` | `series int` | no | Number of interval bars to look back. | `0` |

**Returns**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("time() Example", overlay=true)
// Highlight bars between 09:30 and 11:00 in the exchange's time zone
inWindow = not na(time(interval.interval, "0930-1100"))
bgcolor(inWindow ? color.new(color.orange, 0.15) : na)
```

## `time` (function, overload 2)

**Definition**

Returns the opening time of the current bar in UNIX milliseconds, measured on `interval` rather than on the chart's own bars.

With `session`, it returns `na` when the opening time of the `interval` bar is outside that session. The session is tested against the start of the `interval` bar, not against the opening time of the chart bar: with `interval` "1D" the tested time is the start of the day, so a session that does not contain midnight, such as "0930-1600", gives `na` on every bar of an intraday chart. Interval bars are cut on the clock in that time zone, not aligned to the chart's bars: with `interval` "1h", a chart bar opening at 09:30 is tested as 09:00, so an `interval` equal to the chart's own interval tests the chart bar's own time only when the chart's bars start on those clock boundaries. `timezone` sets the time zone the interval and the session are read in. `bars_back` and `interval_bars_back` look back a number of chart bars or interval bars respectively.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
time(series string interval, series string session, series string timezone, series int bars_back, series int interval_bars_back) → series int
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `interval` | `series string` | no | The interval the time is measured on: a count and a unit, such as "15m", "4h" or "1D", with the units `s`, `m`, `h`, `D`, `W` and `M`. For `D`, `W` and `M` the count must be 1. Any other string compiles and gives `na`. | `interval.interval` |
| `session` | `series string` | no | A session. Bars outside it return `na`. | `""` |
| `timezone` | `series string` | no | The time zone the session is read in. | `syminfo.timezone` |
| `bars_back` | `series int` | no | Number of chart bars to look back. | `0` |
| `interval_bars_back` | `series int` | no | Number of interval bars to look back. | `0` |

**Returns**

`series int`

**Notes**

* `timezone` takes UTC/GMT notation such as "UTC-5" or "GMT+0530", or an IANA time zone name. A name that cannot be read is ignored and the exchange's time zone is used, with no error.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("time() Example", overlay=true)
// Highlight bars between 09:30 and 11:00 in the exchange's time zone
inWindow = not na(time(interval.interval, "0930-1100"))
bgcolor(inWindow ? color.new(color.orange, 0.15) : na)
```

## `time_close` (function, overload 1)

**Definition**

Returns the closing time of the current bar in UNIX milliseconds, measured on `interval`. It takes the same arguments as `time`. With `session` it returns `na` when the opening time of the `interval` bar is outside the session, tested as for `time`: against the start of the `interval` bar, not the opening time of the chart bar.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
time_close(series string interval, series string session, series int bars_back, series int interval_bars_back) → series int
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `interval` | `series string` | no | The interval the time is measured on: a count and a unit, such as "15m", "4h" or "1D", with the units `s`, `m`, `h`, `D`, `W` and `M`. For `D`, `W` and `M` the count must be 1. Any other string compiles and gives `na`. | `interval.interval` |
| `session` | `series string` | no | A session. Bars outside it return `na`. | `""` |
| `bars_back` | `series int` | no | Number of chart bars to look back. | `0` |
| `interval_bars_back` | `series int` | no | Number of interval bars to look back. | `0` |

**Returns**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("time_close Example", overlay=false)
// Minutes left until the daily bar closes
minutesLeft = (time_close("1D") - time) / 60000
plot(minutesLeft, title="Minutes to Daily Close", color=color.blue)
```

## `time_close` (function, overload 2)

**Definition**

Returns the closing time of the current bar in UNIX milliseconds, measured on `interval`. It takes the same arguments as `time`. With `session` it returns `na` when the opening time of the `interval` bar is outside the session, tested as for `time`: against the start of the `interval` bar, not the opening time of the chart bar.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
time_close(series string interval, series string session, series string timezone, series int bars_back, series int interval_bars_back) → series int
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `interval` | `series string` | no | The interval the time is measured on: a count and a unit, such as "15m", "4h" or "1D", with the units `s`, `m`, `h`, `D`, `W` and `M`. For `D`, `W` and `M` the count must be 1. Any other string compiles and gives `na`. | `interval.interval` |
| `session` | `series string` | no | A session. Bars outside it return `na`. | `""` |
| `timezone` | `series string` | no | The time zone the session is read in. | `syminfo.timezone` |
| `bars_back` | `series int` | no | Number of chart bars to look back. | `0` |
| `interval_bars_back` | `series int` | no | Number of interval bars to look back. | `0` |

**Returns**

`series int`

**Notes**

* `timezone` takes UTC/GMT notation such as "UTC-5" or "GMT+0530", or an IANA time zone name. A name that cannot be read is ignored and the exchange's time zone is used, with no error.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("time_close Example", overlay=false)
// Minutes left until the daily bar closes
minutesLeft = (time_close("1D") - time) / 60000
plot(minutesLeft, title="Minutes to Daily Close", color=color.blue)
```

## `timestamp` (function, overload 1)

**Definition**

Assembles a time from its parts - the other direction from the eight functions that take a time apart.

The parts are read as a wall-clock time in the exchange's own timezone, and the result is milliseconds from the Unix epoch, matching `time` and `timenow`.

Two forms. Pass series arguments and you get a series int; pass simple arguments and you get a simple int. In both forms the year, the month and the day are required, and the hour, the minute and the second may be left out, each defaulting to zero. A date string, as in `timestamp("2024-01-01")`, is also accepted, and so is a leading `timezone` string, as in `timestamp("UTC", 2024, 1, 1)`. A date string is read as UTC unless it carries its own zone (`"2024-01-01T09:30:00-05:00"`), not in the exchange's timezone, and a string that cannot be read gives `na`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
timestamp(const string dateString) → const int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `dateString` | `const string` | yes | The date to convert, as a string. |

**Returns**

`const int`

**Notes**

* The result is worked out when the script runs. Where a value is needed when the script is compiled, such as the default of `input.time`, a `timestamp` call gives `na`, and adding the script to the chart fails with "Argument `defval` of `input.time()` cannot be `na`.": write the time as a number of milliseconds instead.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("timestamp")
plot(timestamp(2025, 03, 11, 09, 30), linewidth=3, color=color.green)
plot(timestamp(2025, 03, 11, 09, 30), color=color.yellow)
plot(timestamp(2025, 03, 11, 09, 30, 15), color=color.lime)
```

## `timestamp` (function, overload 2)

**Definition**

Assembles a time from its parts - the other direction from the eight functions that take a time apart.

The parts are read as a wall-clock time in the exchange's own timezone, and the result is milliseconds from the Unix epoch, matching `time` and `timenow`.

Two forms. Pass series arguments and you get a series int; pass simple arguments and you get a simple int. In both forms the year, the month and the day are required, and the hour, the minute and the second may be left out, each defaulting to zero. A date string, as in `timestamp("2024-01-01")`, is also accepted, and so is a leading `timezone` string, as in `timestamp("UTC", 2024, 1, 1)`. A date string is read as UTC unless it carries its own zone (`"2024-01-01T09:30:00-05:00"`), not in the exchange's timezone, and a string that cannot be read gives `na`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
timestamp(series string dateString) → series int
```

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `dateString` | `series string` | yes | The date to convert, as a string. |

**Returns**

`series int`

**Notes**

* The result is worked out when the script runs. Where a value is needed when the script is compiled, such as the default of `input.time`, a `timestamp` call gives `na`, and adding the script to the chart fails with "Argument `defval` of `input.time()` cannot be `na`.": write the time as a number of milliseconds instead.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("timestamp")
plot(timestamp(2025, 03, 11, 09, 30), linewidth=3, color=color.green)
plot(timestamp(2025, 03, 11, 09, 30), color=color.yellow)
plot(timestamp(2025, 03, 11, 09, 30, 15), color=color.lime)
```

## `timestamp` (function, overload 3)

**Definition**

Assembles a time from its parts - the other direction from the eight functions that take a time apart.

The parts are read as a wall-clock time in the exchange's own timezone, and the result is milliseconds from the Unix epoch, matching `time` and `timenow`.

Two forms. Pass series arguments and you get a series int; pass simple arguments and you get a simple int. In both forms the year, the month and the day are required, and the hour, the minute and the second may be left out, each defaulting to zero. A date string, as in `timestamp("2024-01-01")`, is also accepted, and so is a leading `timezone` string, as in `timestamp("UTC", 2024, 1, 1)`. A date string is read as UTC unless it carries its own zone (`"2024-01-01T09:30:00-05:00"`), not in the exchange's timezone, and a string that cannot be read gives `na`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
timestamp(simple int year, simple int month, simple int day, simple int hour, simple int minute, simple int second) → simple int
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `year` | `simple int` | yes | Year. | |
| `month` | `simple int` | yes | Month. | |
| `day` | `simple int` | yes | Day. | |
| `hour` | `simple int` | no | (Optional argument) Hour. Default is 0. | `0` |
| `minute` | `simple int` | no | (Optional argument) Minute. Default is 0. | `0` |
| `second` | `simple int` | no | (Optional argument) Second. Default is 0. | `0` |

**Returns**

`simple int`

**Notes**

* The result is worked out when the script runs. Where a value is needed when the script is compiled, such as the default of `input.time`, a `timestamp` call gives `na`, and adding the script to the chart fails with "Argument `defval` of `input.time()` cannot be `na`.": write the time as a number of milliseconds instead.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("timestamp")
plot(timestamp(2025, 03, 11, 09, 30), linewidth=3, color=color.green)
plot(timestamp(2025, 03, 11, 09, 30), color=color.yellow)
plot(timestamp(2025, 03, 11, 09, 30, 15), color=color.lime)
```

## `timestamp` (function, overload 4)

**Definition**

Assembles a time from its parts - the other direction from the eight functions that take a time apart.

The parts are read as a wall-clock time in the exchange's own timezone, and the result is milliseconds from the Unix epoch, matching `time` and `timenow`.

Two forms. Pass series arguments and you get a series int; pass simple arguments and you get a simple int. In both forms the year, the month and the day are required, and the hour, the minute and the second may be left out, each defaulting to zero. A date string, as in `timestamp("2024-01-01")`, is also accepted, and so is a leading `timezone` string, as in `timestamp("UTC", 2024, 1, 1)`. A date string is read as UTC unless it carries its own zone (`"2024-01-01T09:30:00-05:00"`), not in the exchange's timezone, and a string that cannot be read gives `na`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
timestamp(series int year, series int month, series int day, series int hour, series int minute, series int second) → series int
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `year` | `series int` | yes | Year. | |
| `month` | `series int` | yes | Month. | |
| `day` | `series int` | yes | Day. | |
| `hour` | `series int` | no | (Optional argument) Hour. Default is 0. | `0` |
| `minute` | `series int` | no | (Optional argument) Minute. Default is 0. | `0` |
| `second` | `series int` | no | (Optional argument) Second. Default is 0. | `0` |

**Returns**

`series int`

**Notes**

* The result is worked out when the script runs. Where a value is needed when the script is compiled, such as the default of `input.time`, a `timestamp` call gives `na`, and adding the script to the chart fails with "Argument `defval` of `input.time()` cannot be `na`.": write the time as a number of milliseconds instead.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("timestamp")
plot(timestamp(2025, 03, 11, 09, 30), linewidth=3, color=color.green)
plot(timestamp(2025, 03, 11, 09, 30), color=color.yellow)
plot(timestamp(2025, 03, 11, 09, 30, 15), color=color.lime)
```

## `timestamp` (function, overload 5)

**Definition**

Assembles a time from its parts - the other direction from the eight functions that take a time apart.

The parts are read as a wall-clock time in the exchange's own timezone, and the result is milliseconds from the Unix epoch, matching `time` and `timenow`.

Two forms. Pass series arguments and you get a series int; pass simple arguments and you get a simple int. In both forms the year, the month and the day are required, and the hour, the minute and the second may be left out, each defaulting to zero. A date string, as in `timestamp("2024-01-01")`, is also accepted, and so is a leading `timezone` string, as in `timestamp("UTC", 2024, 1, 1)`. A date string is read as UTC unless it carries its own zone (`"2024-01-01T09:30:00-05:00"`), not in the exchange's timezone, and a string that cannot be read gives `na`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
timestamp(simple string timezone, simple int year, simple int month, simple int day, simple int hour, simple int minute, simple int second) → simple int
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `timezone` | `simple string` | no | The time zone, in UTC/GMT notation (e.g., "UTC-5", "GMT+0530") or as an IANA time zone database name (e.g., "America/New\_York"). A name that cannot be read stops the script with the runtime error `invalid timezone: <name>`. | `syminfo.timezone` |
| `year` | `simple int` | yes | Year. | |
| `month` | `simple int` | yes | Month. | |
| `day` | `simple int` | yes | Day. | |
| `hour` | `simple int` | no | (Optional argument) Hour. Default is 0. | `0` |
| `minute` | `simple int` | no | (Optional argument) Minute. Default is 0. | `0` |
| `second` | `simple int` | no | (Optional argument) Second. Default is 0. | `0` |

**Returns**

`simple int`

**Notes**

* The result is worked out when the script runs. Where a value is needed when the script is compiled, such as the default of `input.time`, a `timestamp` call gives `na`, and adding the script to the chart fails with "Argument `defval` of `input.time()` cannot be `na`.": write the time as a number of milliseconds instead.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("timestamp")
plot(timestamp(2025, 03, 11, 09, 30), linewidth=3, color=color.green)
plot(timestamp(2025, 03, 11, 09, 30), color=color.yellow)
plot(timestamp(2025, 03, 11, 09, 30, 15), color=color.lime)
```

## `timestamp` (function, overload 6)

**Definition**

Assembles a time from its parts - the other direction from the eight functions that take a time apart.

The parts are read as a wall-clock time in the exchange's own timezone, and the result is milliseconds from the Unix epoch, matching `time` and `timenow`.

Two forms. Pass series arguments and you get a series int; pass simple arguments and you get a simple int. In both forms the year, the month and the day are required, and the hour, the minute and the second may be left out, each defaulting to zero. A date string, as in `timestamp("2024-01-01")`, is also accepted, and so is a leading `timezone` string, as in `timestamp("UTC", 2024, 1, 1)`. A date string is read as UTC unless it carries its own zone (`"2024-01-01T09:30:00-05:00"`), not in the exchange's timezone, and a string that cannot be read gives `na`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
timestamp(series string timezone, series int year, series int month, series int day, series int hour, series int minute, series int second) → series int
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `timezone` | `series string` | no | The time zone, in UTC/GMT notation (e.g., "UTC-5", "GMT+0530") or as an IANA time zone database name (e.g., "America/New\_York"). A name that cannot be read stops the script with the runtime error `invalid timezone: <name>`. | `syminfo.timezone` |
| `year` | `series int` | yes | Year. | |
| `month` | `series int` | yes | Month. | |
| `day` | `series int` | yes | Day. | |
| `hour` | `series int` | no | (Optional argument) Hour. Default is 0. | `0` |
| `minute` | `series int` | no | (Optional argument) Minute. Default is 0. | `0` |
| `second` | `series int` | no | (Optional argument) Second. Default is 0. | `0` |

**Returns**

`series int`

**Notes**

* The result is worked out when the script runs. Where a value is needed when the script is compiled, such as the default of `input.time`, a `timestamp` call gives `na`, and adding the script to the chart fails with "Argument `defval` of `input.time()` cannot be `na`.": write the time as a number of milliseconds instead.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("timestamp")
plot(timestamp(2025, 03, 11, 09, 30), linewidth=3, color=color.green)
plot(timestamp(2025, 03, 11, 09, 30), color=color.yellow)
plot(timestamp(2025, 03, 11, 09, 30, 15), color=color.lime)
```

## `weekofyear` (function)

**Definition**

The week of the year of a time you supply.

It is the one member of this family with no variable form: to get the current bar's week, pass the bar's `time`.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
weekofyear(series int time, series string timezone) → series int
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `time` | `series int` | yes | UNIX time, in milliseconds. | |
| `timezone` | `series string` | no | The time zone the value is read in: an IANA time zone database name (for example "America/New\_York") or "UTC". Unlike `timestamp`, `time` and `str.format_time`, this function does not accept offset notation such as "UTC-5" or "GMT+0530": a name that cannot be loaded gives 0, not `na`. | `syminfo.timezone` |

**Returns**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Week of Year Example", overlay=true)
// Current bar time
currentWeek = weekofyear(time)
// Plot week number in Data Window
plot(currentWeek, title="Week Number")
```

## `year` (function)

**Definition**

The year of a time you supply.

Eight functions of this shape exist, each taking a time and an optional timezone, so only the time is required. The variable of the same name reads the current bar instead.

**Syntax**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
year(series int time, series string timezone) → series int
```

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `time` | `series int` | yes | UNIX time, in milliseconds. | |
| `timezone` | `series string` | no | The time zone the value is read in: an IANA time zone database name (for example "America/New\_York") or "UTC". Unlike `timestamp`, `time` and `str.format_time`, this function does not accept offset notation such as "UTC-5" or "GMT+0530": a name that cannot be loaded gives 0, not `na`. | `syminfo.timezone` |

**Returns**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Year Function Example", overlay=true)
// Get current bar year
currentYear = year(time)
// Plot year in Data Window
plot(currentYear, title="Current Year")
```


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