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

# chartPoint functions

> Reference for the 5 functions of the chartPoint namespace: chartPoint.copy, chartPoint.from_index, chartPoint.from_time, chartPoint.new and 1 more, each with its definition and an example.

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

## `chartPoint` (library)

**Definition**

Five functions that build a chart point — `new`, `from_time`, `from_index`, `now` and `copy` — for the type of the same name, whose three fields are a time, an index and a price.

Drawing functions take chart points: `line.new`, `box.new` and `polyline.new` accept them, and `label.set_point`, `line.set_point1`, `line.set_point2`, `box.set_top_left_point` and `box.set_bottom_right_point` set a drawing's position from one.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("chartPoint Library Example", overlay=true)
if barstate.islast {
    start = chartPoint.from_index(bar_index[30], low[30])
    finish = chartPoint.now(high)
    line.new(start, finish, color=color.blue, width=2)
}
```

## `chartPoint.copy` (function)

**Definition**

Hands back a copy of a chart point.

One argument, required: the point to copy.

**Syntax**

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

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `series chartPoint` | yes | A chartPoint object. |

**Returns**

`series chartPoint`

A new chartPoint with the same coordinates as id.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("chartPoint.copy Example", overlay=true)
if barstate.islast {
    p = chartPoint.from_index(bar_index, close)
    c = chartPoint.copy(p)
}
```

## `chartPoint.from_index` (function)

**Definition**

Builds a chart point from a bar index and a price.

Both arguments are required. Where you would rather locate the point by time, use chartPoint.from\_time.

**Syntax**

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

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `index` | `series int` | yes | The x-coordinate of the point, expressed as a bar index value. |
| `price` | `series float` | yes | The y-coordinate of the point. |

**Returns**

`series chartPoint`

A chartPoint with the given bar index and price.

**Example**

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

## `chartPoint.from_time` (function)

**Definition**

Builds a chart point from a time and a price.

Both arguments are required. It is the time-based counterpart of chartPoint.from\_index.

**Syntax**

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

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `time` | `series int` | yes | The x-coordinate of the point, expressed as a UNIX time value, in milliseconds. |
| `price` | `series float` | yes | The y-coordinate of the point. |

**Returns**

`series chartPoint`

A chartPoint with the given UNIX time and price.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("chartPoint.from_time Example", overlay=true)
if barstate.islast {
    p = chartPoint.from_time(time, close)
    pts = array.new<chartPoint>(0)
    array.push(pts, p)
    array.push(pts, chartPoint.from_time(time[5], high[5]))
    polyline.new(pts, xloc=xloc.bar_time, line_color=color.teal)
}
```

## `chartPoint.new` (function)

**Definition**

Builds a chart point with all three of its fields given: a time, a bar index and a price.

All three arguments are required. Use one of the narrower constructors where you have only two of the three.

**Syntax**

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

**Parameters**

| Name | Type | Required | Description |
| - | - | - | - |
| `time` | `series int` | yes | The x-coordinate of the point, expressed as a UNIX time value, in milliseconds. |
| `index` | `series int` | yes | The x-coordinate of the point, expressed as a bar index value. |
| `price` | `series float` | yes | The y-coordinate of the point. |

**Returns**

`series chartPoint`

A chartPoint with the given time, index, and price.

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("chartPoint.new Example", overlay=true)
if barstate.islast {
    p = chartPoint.new(time, bar_index, close)
}
```

## `chartPoint.now` (function)

**Definition**

Builds a chart point from a price alone: you give no time and no bar index, and even the price is optional.

The point is placed at the current bar: its index is `bar_index`, its time is the open time of the bar (the same value as `time`), and its price is `price`.

**Syntax**

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

**Parameters**

| Name | Type | Required | Description | Default |
| - | - | - | - | - |
| `price` | `series float` | no | The y-coordinate of the point. Optional. The default is close. | `close` |

**Returns**

`series chartPoint`

A chartPoint at the current bar, with the given price (default close).

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("chartPoint.now Example", overlay=true)
if barstate.islast {
    p = chartPoint.now(high)
}
```


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