Lipi Reference Lipi

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) → series plot
              

Arguments

series required series float The values to draw, one per bar. The only required argument. An `na` in the series leaves a gap on that bar; it does not draw a zero.
title const string The plot's name. Const-form, so it cannot be built from series data. Every output function defaults its title to the same word, so untitled plots share one name rather than being numbered — give each plot its own.
color series color The colour to draw in. Series-form, so it may differ on every bar. This is where a condition goes, since the call itself cannot be made conditionally.
linewidth input int How wide the line is drawn. Input-form, so it is settled before the script runs and holds for every bar.
style input plotStyle Which member of the `plotStyle` set to draw — a line, an area, a histogram, a stepped variant, and so on. The interpreter records the member you name and leaves its appearance to the chart.
trackprice input bool Accepted and type-checked, then ignored. Nothing in the interpreter reads it and the plot's details carry no field for it, so it has no effect on what you see. Leave it out.
histbase input float The base the histogram styles are measured from. Input-form, so it is fixed for the run of the script.
offset input int Shifts the plot along the chart. Input-form, so it cannot change from bar to bar. When you fill between two plots, the fill keeps an offset only if both plots carry the same one.
force_overlay const bool Sets this one plot's overlay, separately from the script-wide setting that `indicator` carries.

Return Type

series plot

Example


          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)