plot draws one value per bar. Its relatives mark bars (plotshape, plotchar, plotarrow), draw candles or bars of your own
(plotcandle, plotbar) or draw a level (hline). For anything that is not one value on every bar, see
Plots or drawings.
Top level only
Every one of these calls, andfill, bgcolor, barcolor and alertcondition, must stand at the top level of the script: not in
an if, a loop, a switch or a function of yours. The editor refuses it:
plot() must be called in the global scope.
Put the condition in the arguments instead. A plotted na leaves a gap, and a na color draws nothing:
plot
plot(series, title, color, linewidth, style, trackprice, histbase, offset, force_overlay, display, format). Only series is
required.
A computed
linewidth is refused (An argument of series inttype was used but ainput int is expected.). To vary a plot’s look by bar, vary its color, or plot twice with different arguments.
plot returns a plot value that fill accepts.
Where a plot is shown: display and format
display takes display.none, pane, data_window, price_scale, status_line or all (the default); add constants with +:
display=display.pane + display.price_scale. It is an argument of every call on this page and of fill, bgcolor, barcolor and
the inputs; the terminal decides what each place shows. fill, barcolor and bgcolor take only display.none and display.all
(see Fills and levels).
format on plot, plotshape, plotchar, plotarrow and hline takes format.price, format.percent or format.volume. The
editor accepts format.mintick and format.inherit; adding the script to the chart refuses them:
format argument only accepts format.price, format.percent, or format.volume. Got format.mintick.
Marks on bars
plotshape(series, title, shape, location, color, offset, text, textcolor, size, force_overlay, display, format)draws a shape on each bar where theboolseries is true.shapeisshape.xcross,cross,triangleup,triangledown,flag,circle,arrowup,arrowdown,labelup,labeldown,squareordiamond;locationislocation.abovebar,belowbar,top,bottomorabsolute;sizeissize.auto,tiny,small,normal,largeorhuge. Given afloatseries instead, it draws at that price, and anadraws nothing.plotcharis the same withchar, one character (const string) instead ofshape; a longer string is cut to its first character.plotarrow(series, title, colorup, colordown, offset, minheight, maxheight, force_overlay, display, format)draws an arrow up for a positive value and down for a negative one, sized by the value.textis aconst string; see Text and markers.
Your own bars and a level
plotcandle(open, high, low, close, title, color, wickcolor, bordercolor, force_overlay, display) and plotbar(open, high, low, close, title, color, display, force_overlay) draw bars from four series; all four are required. hline(price, title, color, linewidth, style, display, format) draws a horizontal line; price is an input value (see
Fills and levels): plotcandle(talib.sma(open, 3), talib.sma(high, 3), talib.sma(low, 3), talib.sma(close, 3)).