filledArea

This lets you fill the space between two lines with a color. It’s perfect for showing zones like Bollinger Bands, channels, or shaded areas between support and resistance. Instead of just seeing two lines, the area between them becomes highlighted, making it much easier to read the chart.

Imagine:

  • Shading the area between an upper and lower band.

  • Coloring the space between a fast MA and slow MA.

  • Highlighting a support/resistance zone.

Syntax

plot.filledArea(id, objATitle, objBTitle, title, color, transparency?, visible?, type?)

Parameters

  • id string — A unique name for this filled area.

  • objATitle string — The title of the first line (must already exist).

  • objBTitle string — The title of the second line (must already exist).

  • title string — Label for this filled area.

  • color string — The color used to fill the area (like "rgba(0, 255, 0, 0.2)").

  • transparency number (optional, default = 90) — How transparent the fill is.

  • visible boolean (optional, default = true) — Show or hide the filled area.

  • type FilledAreaType (optional) — Defines the type of area (usually not needed, default works).

    TypeHlines = "hline_hline" Filled area type for bands. • TypePlots = "plot_plot" Filled area type for plots.

Return Value

Nothing (it just creates the fill on the chart).

Example

Result

Tips

  • Filled areas make it much easier for users to “see the zone” instead of just comparing two lines.

  • Use transparent colors so the price bars are still visible behind the shading.

Warning

Good Practice

Last updated