Lipi Reference
Lipi

Functions

chartPoint.from_index()

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

                chartPoint.from_index(series int index, series float price) → series chartPoint
              

Arguments

index required series int The x-coordinate of the point, expressed as a bar index value.
price required series float The y-coordinate of the point.

Return Type

series chartPoint

Example


          //@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)
}