Outputs & helpers

The constructs that put things on the chart or raise events. mark buy/sell are also what the backtester trades and the scanner matches on the last closed bar.

draw line

draw line(value, color:, title:, width:, style:)

Plot a series as a line on the chart.

valueseriesThe per-bar values to plot.
color / title / width / stylenamed`style: "dashed" | "dotted"`, `width:` in px.

Returns: chart plot

PulseScript
pulse 1
draw line(ema(close, 20), color: "#38bdf8", title: "EMA 20")

draw area

draw area(value, color:, title:)

Plot a series as a filled area from the zero line.

valueseriesPer-bar values.

Returns: chart plot

PulseScript
pulse 1
meta(name: "RSI", overlay: false)
draw area(rsi(close, 14), color: "#7c9cff", title: "RSI")

draw steps

draw steps(value, color:, title:)

Plot a series as a step line (holds each value until the next).

valueseriesPer-bar values.

Returns: chart plot

PulseScript
pulse 1
draw steps(sma(close, 20), title: "SMA steps")

draw dots

draw dots(value, color:, title:)

Plot a series as discrete dots.

valueseriesPer-bar values.

Returns: chart plot

PulseScript
pulse 1
draw dots(ta.pivotHigh(high, 5, 5), color: "#ef4444", title: "pivots")

draw hist

draw hist(value, color:, title:)

Plot a series as a histogram of bars from the zero line.

valueseriesPer-bar values (often a difference).

Returns: chart plot

PulseScript
pulse 1
meta(name: "MACD hist", overlay: false)
draw hist(ta.macdFull().histo, title: "histogram")

draw band

draw band(upper, lower, color:, title:)

Fill the area between two series (e.g. Bollinger Bands).

upperseriesTop edge.
lowerseriesBottom edge.

Returns: chart plot

PulseScript
pulse 1
b = ta.bands(20, 2)
draw band(b.upper, b.lower, color: "rgba(124,156,255,0.15)", title: "BB")

draw level

draw level(y, color:, title:, style:)

A constant horizontal reference line at price/value `y`.

ynumberThe level.

Returns: chart level

PulseScript
pulse 1
meta(name: "RSI", overlay: false)
draw line(rsi(close, 14), title: "RSI")
draw level(70, color: "#ef4444", title: "overbought")
draw level(30, color: "#22c55e", title: "oversold")

draw marker

draw marker(cond, at:, shape:, color:, text:, size:)

Draw a shape on bars where `cond` is true. Shapes: circle, square, diamond, cross, triangleUp/Down, arrowUp/Down, flag.

condboolWhen to place the marker.
at"above" | "below" | numberPosition relative to the bar, or an explicit price.
shape / color / text / sizenamedAppearance.

Returns: chart markers

PulseScript
pulse 1
draw marker(crossOver(ema(close, 9), ema(close, 21)), at: "below", shape: "triangleUp", color: "#22c55e")

mark buy / sell / note

mark buy|sell|note at <price> "text"

Drop a signal marker. `mark buy`/`sell` are also what the backtester trades and the scanner matches on the last closed bar.

at <price>seriesWhere to anchor it, e.g. `at low` / `at high`.
"text"text?Optional label baked onto the marker.

Returns: signal markers

PulseScript
pulse 1
when crossOver(ema(close, 9), ema(close, 21)): mark buy at low "Long"
when crossUnder(ema(close, 9), ema(close, 21)): mark sell at high "Short"

paint bg

paint bg(color)

Tint the chart background on the current bar (usually gated by a condition).

colorcolorAn rgba() colour with low opacity works best.

Returns: background tint

PulseScript
pulse 1
when close > open: paint bg(rgba(34, 197, 94, 0.06))
when close < open: paint bg(rgba(239, 68, 68, 0.06))

paint candles

paint candles(color)

Recolour the candle body on the current bar.

colorcolorThe candle colour for this bar.

Returns: candle tint

PulseScript
pulse 1
when rsi(close, 14) > 70: paint candles(rgba(239, 68, 68, 0.8))
when rsi(close, 14) < 30: paint candles(rgba(34, 197, 94, 0.8))

alert()

alert("message")

Raise an alert event on the current bar — captured in the console today; the live alert-engine bridge lands in a coming release.

messagetextThe alert text.

Returns: alert event

PulseScript
pulse 1
when crossOver(ema(close, 9), ema(close, 21)): alert("EMA 9 crossed above EMA 21")

onTf()

onTf(timeframe, expr) → series

Evaluate an expression on a higher timeframe, mapping back only COMPLETED bars — strict no-repaint.

timeframetextHigher timeframe, e.g. "4h", "1d".
exprseriesAny price / ta.* expression to compute on that timeframe.

Returns: series (HTF value mapped to chart bars)

PulseScript
pulse 1
htfTrend = onTf("4h", ema(close, 20))
draw line(htfTrend, color: "#a78bfa", title: "4h EMA 20")

nz()

nz(x, replacement?) → number

Replace none / non-finite values with `replacement` (default 0).

xnumberValue that might be none.
replacementnumber?Fallback (default 0).

Returns: number

PulseScript
pulse 1
draw line(nz(sma(close, 50), close), title: "SMA (close during warmup)")

na()

na(x) → bool

True when x is none / not-a-number (e.g. during an indicator’s warmup).

xnumberValue to test.

Returns: bool

PulseScript
pulse 1
when na(sma(close, 50)): mark note at high "warming up"