Skip to main content

Overview

These four functions complement plot() with static and per-bar visual layers:

hline

Draws a static horizontal line across the entire chart at a fixed price/value. Call at the top level.
Options: Budget: maximum 64 hlines per indicator.

fill

Shades the area between two plot series. Both plots must be registered before calling fill. Call at the top level.
Options: Budget: maximum 64 fills per indicator.

bgcolor

Overrides the chart background color for the current bar. Call inside onBar.
Budget: maximum 1000 bgcolor entries (capped to the last 1000 bars with a non-null color). Passing null clears the color for that bar.

barcolor

Overrides the candle/bar color on the main price chart for the current bar. Call inside onBar.
Budget: maximum 1000 barcolor entries.

Per-bar vs static

bgcolor and barcolor only take effect for bars where they are explicitly called. Bars without a call retain the default chart color.

Complete RSI indicator example

Plot basics

plot() - the main time-series drawing primitive.

color.*

Color format and named constants.

API limits

Budget numbers for all drawing primitives.