KLineChart-return
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
| Name | Type | Description |
begin(bar) | function | Starts drawing on one bar ( |
close(bar) | function | Ends drawing on the current bar. In |
barcolor(color, offset, editable, show_last, title, display) | function | Sets the bar color. |
bgcolor(color, offset, editable, show_last, title, display, overlay) | function | Fills the bar background with the given color. |
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(plot1, plot2, color, title, editable, show_last, fillgaps, display) | function | Fills the background between two lines (return values of |
hline(price, title, color, linestyle, linewidth, editable, display, overlay) | function | Draws a horizontal line at a fixed price. |
plotarrow(series, title, colorup, colordown, offset, minheight, maxheight, editable, show_last, display, overlay) | function | Draws up and down arrows (positive values up, negative down). |
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 |
plotchar(series, title, char, location, color, offset, text, textcolor, editable, size, show_last, display, overlay) | function | Draws a shape with any Unicode character. |
plotcandle(open, high, low, close, title, color, wickcolor, editable, show_last, bordercolor, display, overlay) | function | Draws a candlestick. |
signal(direction, price, qty, id) | function | Not in Pine: draws a trading signal. |
reset(remain) | function | Not in Pine: clears the chart data; |
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.