Pine Script numeric plots

Pine Script Plot: Series, Styles, Gaps and Display Controls

Pine Script plot() outputs a numeric series, with one value or na on each bar. Keep the call in global scope and choose its series, style and display destinations separately. The default line can bridge missing values; linebr leaves breaks. A hidden color preserves the number, while display.none hides the output everywhere and removes its scale contribution.

Build or debug a Pine Script plot

Start with the numeric series and global scope

The series argument supplies the y-value on each bar. It can be a price, a moving average, a calculated oscillator or a constant. plot() returns a plot ID, which can be stored for fill(); that ID is different from the numeric series. A title is a compile-time string used to identify the output in settings and readouts.

  • A plot call belongs outside if blocks, loops and function bodies. Calculate a conditional value first, then pass it to a global plot call.
  • For conditional output, select the number when enabled and na otherwise. Replacing missing values with zero creates real zero observations and can stretch the scale.
  • A series boolean is not a numeric plot argument. An explicit condition ? 1 : 0 conversion makes the intended numeric representation clear.
  • On an open market bar, a series based on close can change with updates. Choosing a different plot style does not confirm the underlying calculation.

Compare five styles on the same missing-value sequence

Paste this complete v6 indicator into Pine Editor and add it to a chart. It uses synthetic numbers, so market prices and indicator warm-up do not affect the test. Phase repeats from 0 through 9. Raw values are 2, 4, 6, 8, 10, 12, 14, 16, 18 and 20; phases 4 and 5 become na in the gapped series. Each style has its own vertical lane. The added lane values are display coordinates, not different source data.

  • Zoom to several ten-bar cycles. The drop from phase 9 to phase 0 is intentional: the sequence resets from 20 to 2.
  • Keep both sides of the missing interval visible when checking the blue bridge. A bridge needs a later non-missing point.
  • These are missing observations on existing chart bars. The script does not insert weekend or closed-session bars.
Style / laneExpected drawingWidth and baseline
line / 0Connects 8 at phase 3 to 14 at phase 6 across the missing valueslinewidth sets line thickness
linebr / +30Leaves a break between the runs ending at phase 3 and starting at phase 6linewidth sets line thickness
stepline / +60Uses horizontal steps and vertical transitions; this example also hides the color on gap barsStep geometry differs from the diagonal linebr segments
histogram / +90Draws separate bars from 90 to the non-missing lane valuelinewidth=4 sets bar width in pixels
columns / +120Draws separate columns from 120 to the non-missing lane valuelinewidth does not control column width
Complete v6 style comparison. All plots have offset 0. Read Phase in the Data Window to locate a test bar.pinescript
//@version=6
indicator("plot styles and missing values", overlay=false, precision=0)

int phase = bar_index % 10
float raw = 2.0 * (phase + 1)
bool isGap = phase == 4 or phase == 5
float gapped = isGap ? na : raw

plot(gapped, title="Line", color=color.blue, linewidth=2)
plot(gapped + 30, title="Linebr +30", color=color.orange, linewidth=2, style=plot.style_linebr)
plot(gapped + 60, title="Stepline +60", color=isGap ? na : color.teal, linewidth=2, style=plot.style_stepline)
plot(gapped + 90, title="Histogram +90", color=color.purple, linewidth=4, style=plot.style_histogram, histbase=90)
plot(gapped + 120, title="Columns +120", color=color.gray, style=plot.style_columns, histbase=120)
plot(raw + 150, title="Color only +150", color=isGap ? na : color.red, linewidth=2)
plot(phase, title="Phase", display=display.data_window)
plot(raw, title="Raw", display=display.data_window)
plot(gapped, title="Gapped", display=display.data_window)

Read the gap in the Data Window

Open the Data Window, expand this indicator and move the crosshair across phases 3 through 6. With the script and Style settings unchanged, the numeric contract is below. na means there is no numeric observation; TradingView may render that as an unavailable-value symbol. The table states expected output from the code, not a captured chart session.

  • At phase 4, the blue line can cross the gap visually, but its Data Window value is still na. The connecting stroke does not manufacture a stored observation.
  • Color only +150 still has values 160 and 162 while its color is na. Hiding a stroke does not remove its numerical output or guarantee that it stops affecting scale.
  • If linebr has no visible stroke around an isolated valid bar, check the numeric readout. A single point without a neighboring valid point may not form a visible line segment.
Plot titlePhase 3Phase 4Phase 5Phase 6
Raw8101214
Gapped / Line8nana14
Linebr +3038nana44
Stepline +6068nana74
Histogram +9098nana104
Columns +120128nana134
Color only +150158160162164

histbase is a coordinate, not an addition to the series

In the first example, Histogram +90 reaches 98 on phase 3 because the script explicitly plots raw + 90. histbase=90 supplies the other end of the bar. The height is 98 - 90 = 8. Changing only histbase would move that endpoint without changing the plotted value of 98.

  • histbase requires an input-compatible number; it cannot follow a different series value on every bar.
  • Histogram and columns include their baseline in the pane scale. A zero baseline can compress price-like values far from zero.
  • For a changing baseline, plot the two series and use fill() between their plot IDs, or calculate a difference series around a fixed zero baseline.
Series valuehistbaseResult
9890Bar extends 8 units above 90; readout remains 98
8890Bar extends 2 units below 90; readout remains 88
9090Zero-height bar; numeric value remains 90
na90No numeric bar

Choose display destinations without changing the calculation

display controls where a plot is presented. It does not turn the calculation into an alert or a trade. Combine destinations with + and remove them with -. Chart and indicator settings can also suppress permitted readouts, so inspect those settings when a status-line or price-scale value is missing.

display argumentOutput destinationsPractical consequence
display.allPane, status line, price scale and Data WindowDefault presentation
display.panePane onlyDrawing can still influence the pane scale
display.data_windowData Window onlyInspect a number without a pane drawing or its scale contribution
display.status_line + display.data_windowStatus line and Data WindowTwo numeric readouts without a pane drawing
display.all - display.status_lineAll destinations except status lineKeep the chart and Data Window, reduce status-line clutter
display.all - display.paneNumeric destinations onlyStill permits a price-scale label; this is not display.none
display.noneNo visible destinationCalculated output remains available for supported downstream uses; no scale contribution

Test hidden numbers and scale separately

Run this second indicator by itself in a new pane. Leave Enable invisible scale probe off initially. The visible series stays between 2 and 20; Data Window only and Readouts only deliberately use larger numbers. Hidden output computes 10000 without appearing in the Data Window. Turn the probe on with automatic scale enabled to see why color=na is unsuitable for removing a diagnostic from the scale.

  • The readout format is set to zero decimal places for these integer fixtures. Display precision changes formatting, not the values used by calculations.
  • If the probe produces no apparent scale change, restore automatic scaling and check any manual scale settings. Compare the same visible bar range.
  • display.none is useful for a plot consumed as an external input or an alert placeholder. It does not create a running alert by itself.
Output at phase 4Probe offProbe onPane behavior
Visible1010Blue line in both cases
Data Window only110110No drawing or scale contribution
Readouts only210210No drawing or scale contribution
Hidden outputNo Data Window entryNo Data Window entry10000 does not stretch the scale
Invisible scale probena1010No colored stroke; the enabled numeric series can stretch the automatic scale
Complete v6 display comparison. Hidden output uses display.none; Invisible scale probe uses a hidden color.pinescript
//@version=6
indicator("plot display destinations", overlay=false, precision=0)

bool enableProbe = input.bool(false, "Enable invisible scale probe")
int phase = bar_index % 10
float raw = 2.0 * (phase + 1)

plot(raw, title="Visible", color=color.blue, linewidth=2, display=display.all - display.status_line)
plot(raw + 100, title="Data Window only", display=display.data_window)
plot(raw + 200, title="Readouts only", display=display.status_line + display.data_window)
plot(10000, title="Hidden output", display=display.none)
plot(enableProbe ? raw + 1000 : na, title="Invisible scale probe", color=na)
plot(phase, title="Phase", display=display.data_window)

Offset moves the drawing, not the time of knowledge

A positive offset displays a value to the right; a negative offset displays it to the left. In v6, the offset cannot be a series that changes on each bar. For a value calculated on bar index 40, offset +3 displays it at 43 and offset -2 displays it at 38. In both cases the calculation was available on bar 40.

  • Both examples use the default offset 0 so the crosshair and calculation bar agree. Keep an unshifted Data Window diagnostic when adding an offset to your own visual plot.
  • A pivot confirmed several bars later can be drawn back at its pivot bar. That historical placement does not prove a strategy could have acted there.
  • Changing offset does not fix future-data leakage, confirm an open-bar value, move a strategy order or change the timing of a separate alert condition.

Turn a plotting failure into a reproducible request

Give Pineify the complete script, Pine version, failing plot title, expected values on specific bars, intended gap behavior and display destinations. For the first fixture, require Line to report na at phases 4 and 5 while its stroke bridges the gap, and require Color only +150 to retain 160 and 162. Request a syntax check, then compare chart output and Data Window values in TradingView.

SymptomCheck before changing the formula
Cannot use plot in local scopeMove the call to global scope; keep the condition in the series or color argument
Line joins a gapConfirm the series is na, then select linebr
Empty pane but populated Data WindowInspect display, color, Style visibility and pane placement
An oscillator or price plot looks flatInspect invisible plots, histogram baselines and other values sharing the scale
Plot absent during warm-upCheck whether its input series is na before replacing missing values
Where Pineify fits

Pine Script AI Coding Agent

Ask Pineify to generate or revise a numeric plot from explicit series, gap and display requirements. Request syntax validation, then check the resulting values and drawing in TradingView.

Build or debug a Pine Script plot

Frequently asked questions

These synthetic examples test plotting behavior. They are not trading signals or investment advice. Syntax validation does not establish chart appearance, alert behavior or strategy performance.

Sources and verification

Published by Pineify. Pineify is an independent product and is not affiliated with TradingView. Sources support the technical explanations; examples do not establish trading performance.