Skip to content
TradequixDocsOpen the terminal
OverviewStart here, search, progress
  • Introduction
  • Quickstart
  • How a script runs
  • Types and qualifiers
  • Operators, conditionals and loops
  • Functions and methods
  • Objects and enums
  • Arrays, matrices and maps
  • Strings and colours
  • Time and sessions
  • Bar states
  • Plotting
  • Inputs
  • Technical analysis
  • Drawings and tables
  • Multiple timeframes
  • Strategies
  • Alerts in scripts
  • Repainting
  • The Pine editor
  • Indicator settings
  • Coming from TradingView
  • The data
  • Publish and sell
  • Catalogue and community
  • Your dashboard and earnings
  • Errors and debugging
  • Limits
  • Coverage
  • Built-in catalogue
  • Cookbook
  • Write Pine with AI
  • FAQ
  • Glossary
  • Cheat sheet
  • Function reference
  • Will it run here?
  • Error index

Write

Plotting

Every way a script draws a series: plot styles, markers, reference lines, fills and colouring bars, on the price chart or in its own pane.

View as MarkdownOpen in ClaudeOpen in ChatGPT

A script that computes something still needs to draw it. Pine's drawing functions take a series and turn it into lines, markers or colours on the chart.

Price chart or its own pane#

indicator("...", overlay = true) draws on the price chart. Leave overlay out (it defaults to false) and the script gets its own pane below the chart, with its own scale. Oscillators such as RSI belong in a pane; averages and bands belong on price.

A single script can still put one visual on the price chart from a pane with force_overlay = true on that call.

plot() and its styles#

RunnablePlot styles
1//@version=62indicator("Plot styles")3mom = ta.mom(close, 10)4plot(mom, "Momentum", style = plot.style_columns, color = mom >= 0 ? color.new(color.teal, 30) : color.new(color.red, 30))5plot(ta.sma(mom, 9), "Signal", color = color.orange, linewidth = 2)6hline(0, "Zero", color = color.gray)
StyleDraws
plot.style_line (default)A continuous line
plot.style_linebrA line with gaps where the value is na
plot.style_steplineSteps instead of slopes
plot.style_histogramThin bars from the base line
plot.style_columnsWide bars from the base line
plot.style_area / style_areabrA filled area
plot.style_circles / style_crossA dot or a cross per bar

Useful arguments: linewidth, color (which can change per bar, as above), offset to shift the plot left or right, show_last to draw only the last N bars, and display = display.none to compute a plot without drawing it (handy as the input to a fill).

Markers: plotshape, plotchar, plotarrow#

Markers mark events, not values. plotshape draws a shape, plotchar draws a character, plotarrow draws an arrow sized by its value (positive up, negative down).

RunnableRSI extremes
1//@version=62indicator("RSI extremes", overlay = true)3r = ta.rsi(close, 14)4plotshape(ta.crossunder(r, 30), "Oversold", style = shape.circle, location = location.belowbar, color = color.teal, size = size.tiny)5plotshape(ta.crossover(r, 70), "Overbought", style = shape.circle, location = location.abovebar, color = color.red, size = size.tiny)6plotchar(ta.cross(close, ta.sma(close, 50)), "Cross 50", char = "x", location = location.top, color = color.orange)

Watch out

A marker appears only where the series is true or a non-zero number. na, false and 0 draw nothing. So plotshape(ta.pivothigh(high, 5, 5)) does draw, at each pivot, because a pivot returns a price; but a condition like not na(ph) says what you mean more clearly. If your markers never appear, print the series with plot() first and check it is ever true.

Locations: location.abovebar, location.belowbar, location.top, location.bottom, and location.absolute, which places the marker at the series value itself.

Reference lines and fills#

hline(price) draws a fixed horizontal line. fill(a, b, color) shades between two plots or two hlines; pass the objects those calls return.

RunnableBollinger fill
1//@version=62indicator("Bollinger fill", overlay = true)3[mid, up, lo] = ta.bb(close, 20, 2)4p1 = plot(up, "Upper", color = color.new(#8b7cff, 0))5p2 = plot(lo, "Lower", color = color.new(#8b7cff, 0))6plot(mid, "Basis", color = color.new(#ffb547, 0))7fill(p1, p2, color = color.new(#8b7cff, 88), title = "Band")

Colouring the chart itself#

  • bgcolor(color) tints the background of a bar.
  • barcolor(color) recolours the candles.
RunnableTrend tint
1//@version=62indicator("Trend tint", overlay = true)3trendUp = ta.ema(close, 20) > ta.ema(close, 50)4bgcolor(trendUp ? color.new(color.teal, 90) : color.new(color.red, 92))5barcolor(close > open ? color.teal : color.red)

Drawing candles#

plotcandle and plotbar draw your own OHLC series, for example Heikin Ashi computed by hand, in a pane or on price.

How close it is to TradingView#

Every style above is drawn natively. A few things are approximations rather than pixel-identical: some marker and label shapes, proportional arrow sizing, curved lines, and table layout. The numbers are exact; the shapes are close.

PreviousBar statesNext Inputs

On this page

  • Price chart or its own pane
  • plot() and its styles
  • Markers: plotshape, plotchar, plotarrow
  • Reference lines and fills
  • Colouring the chart itself
  • Drawing candles
  • How close it is to TradingView

Use with AI

View as MarkdownOpen in ClaudeOpen in ChatGPT