Type/to search
Built-in Functions
Structures
Ticker
Depth
OrderBook
Trade
Record
Market
Order
Condition
Account
Asset
Position
Funding
Other Structures
HttpQuery-options
HttpQuery-return
LogStatus-table
LogStatus-btnTypeOne
LogStatus-btnTypeTwo
Status Bar Components
Chart-options
Chart-return
KLineChart-options
KLineChart-return
SetData-data
EventLoop-return
exchange.Go-return
DBExec-return
Dial-return
Thread.join-return
Built-in Variables and Constants
Conventions
Exchanges

The chart object returned by KLineChart, which draws on K-lines in a Pine-like way. When iterating over bars, the drawing calls for each bar start with begin(bar) and end with close(bar).

Attributes

NameTypeDescription

begin(bar)

function

Starts drawing on one bar (Record). The drawing calls for each bar must start with begin(bar) and end with close(bar).

close(bar)

function

Ends drawing on the current bar. In Rust it is close() without an argument.

barcolor(color, offset, editable, show_last, title, display)

function

Sets the bar color. display: none or all.

bgcolor(color, offset, editable, show_last, title, display, overlay)

function

Fills the bar background with the given color. display: none or all.

plot(series, title, color, linewidth, style, trackprice, histbase, offset, join, editable, show_last, display, overlay)

function

Plots a data line and returns its number (for fill()). See the remarks for the values of style and display.

fill(plot1, plot2, color, title, editable, show_last, fillgaps, display)

function

Fills the background between two lines (return values of plot() or hline()) with a color. display: none or all.

hline(price, title, color, linestyle, linewidth, editable, display, overlay)

function

Draws a horizontal line at a fixed price. linestyle: dashed, dotted, solid; display: none or all.

plotarrow(series, title, colorup, colordown, offset, minheight, maxheight, editable, show_last, display, overlay)

function

Draws up and down arrows (positive values up, negative down). display: none or all.

plotshape(series, title, style, location, color, offset, text, textcolor, editable, size, show_last, display, overlay)

function

Draws a shape. See the remarks for the values of style, location, size and display.

plotchar(series, title, char, location, color, offset, text, textcolor, editable, size, show_last, display, overlay)

function

Draws a shape with any Unicode character. location, size and display take the same values as in plotshape().

plotcandle(open, high, low, close, title, color, wickcolor, editable, show_last, bordercolor, display, overlay)

function

Draws a candlestick. display: none or all.

signal(direction, price, qty, id)

function

Not in Pine: draws a trading signal. direction: long, closelong, short, closeshort; price is the vertical position of the mark; qty is the quantity; the optional id replaces the default text (the direction).

reset(remain)

function

Not in Pine: clears the chart data; remain is the number of data points to keep, all are cleared when omitted. Rust requires remain.

See Also

Remarks

All parameters after the first can be omitted. JavaScript cannot pass arguments by name, so use an object {name: value}, for example c.fill(h, l, {color: "rgba(255, 0, 0, 0.2)", title: "fill"}) or c.plotshape(bar.Low, {style: "diamond"}); Python uses keyword arguments, for example c.plotshape(bar.Low, style = "diamond"); in Rust the last parameter of each method is a JSON string of options ("{}" for none), for example c.plot(bar.High, r#"{"title": "high"}"#), and the first parameter of plotshape() and plotchar() is a boolean that draws on the bar when true.

Colors can be written as "rgba(255, 0, 0, 0.2)" or "#FF0000".

Values for plot(): style: stepline_diamond, stepline, cross, areabr, area, circles, columns, histogram, linebr, line; display: none or all. A NaN value (None in Python) leaves the point out, which together with linebr draws a broken line.

Values for plotshape(): style: diamond, square, label_down, label_up, arrow_down, arrow_up, circle, flag, triangle_down, triangle_up, cross, xcross; location: abovebar, belowbar, top, bottom, absolute; size: 10px, 14px, 20px, 40px, 80px (Pine size.tiny, size.small, size.normal, size.large, size.huge; size.auto is size.small); display: none or all.