Functions
plot()
Draws a series on the chart, one point per bar. It is the output function you will reach for first. Nine parameters, of which only the first is required — every other one carries a default. The call has to sit at the top level of the script: put it inside a branch, a loop or a function of your own and the script is rejected for not being in the global scope. A condition therefore belongs in the `color` argument, not around the call.
Syntax
plot(series float series, const string title, series color color, input int linewidth, input plotStyle style, input bool trackprice, input float histbase, input int offset, const bool force_overlay, input display display, input string format) → series plot
Arguments
series required series float Series of data to be plotted. Required argument. title const string Title of the plot. color series color Color of the plot. You can use constants like 'color=color.red' or 'color=#ff001a' as well as complex expressions like 'color = close >= open ? color.green : color.red'. Optional argument. linewidth input int Width of the plotted line. Default value is 1. Not applicable to every style. style input plotStyle Type of plot. Possible values are: plotStyle.line, plotStyle.stepLine, plotStyle.stepLinebr, plotStyle.stepArea, plotStyle.stepAreabr, plotStyle.histogram, plotStyle.area,plotStyle.areabr, plotStyle.bar, plotStyle.scatter, plotStyle.cross,plotStyle.smoothedArea,plotStyle.triangular. Default value is plotStyle.line. trackprice input bool If true then a horizontal price line will be shown at the level of the last indicator value. Default is false. histbase input float The price value used as the reference level when rendering plot with plot.style_histogram, plot.style_columns or plot.style_area style. Default is 0.0. offset input int Shifts the plot to the left or to the right on the given number of bars. Default is 0. force_overlay const bool If true, the plotted results will display on the main chart pane, even when the script occupies a separate pane. Optional. The default is false. display input display Controls where the plot is shown (pane, price scale, status line, data window). Use display.* constants; combine with +. Default is display.all. format input string Return Type
series plot Example
//@lipi=2
indicator("Conditional Plot", overlay=true)
signal = close > talib.sma(close, 14) ? close : na
plot(signal, color=color.green, title="Above SMA Signal", style=plotStyle.scatter)