Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.darvas.app/llms.txt

Use this file to discover all available pages before exploring further.

Signature

LineFill(key, lineA, lineB, opts) -> handle
A LineFill shades the region between two existing Line entity handles. The source lines are specified at creation time and cannot be changed afterwards - to retarget, delete the fill and create a new one.

Quick example

const top = Line("upper-band", { x1: 0, y1: 105, x2: 50, y2: 105, color: "#22c55eFF" });
const bot = Line("lower-band", { x1: 0, y1: 95,  x2: 50, y2: 95,  color: "#22c55eFF" });

const fill = LineFill("band-fill", top, bot, {
  color: "#22c55e30",
});

Options

key
string
required
Unique slot key for this fill.
lineA
handle
required
Handle returned by the first Line() call.
lineB
handle
required
Handle returned by the second Line() call.
color
string
Fill color as #RRGGBBAA. Use low alpha (e.g. #22c55e30) for zone shading.

Source line immutability

The source line keys (lineA and lineB) are fixed at construction time. You cannot retarget a LineFill to different lines after creation. To change which lines a fill references, delete the fill and recreate it.
// Correct: delete + recreate to change source lines
fill.delete();
const newFill = LineFill("band-fill", newTop, newBot, { color: "#ef444430" });

forceOverlay constraint

Both source lines must have the same forceOverlay value. Mixing forceOverlay: true and forceOverlay: false lines in a single LineFill raises an error at construction time.
The forceOverlay constraint is checked when the LineFill is constructed, not when it is rendered. If the source lines have mismatched forceOverlay settings, the LineFill will fail silently (not rendered) and log a warning.

Handle methods

fill.set({ color: "#a78bfa30" }); // change fill color
fill.clone("band-fill-2");        // clone with same source lines
fill.delete();                    // remove fill

Bollinger Bands fill example

const upperPlot = Line("bb-upper", { x1: 0, y1: 0, x2: 0, y2: 0, color: "#3b82f6FF" });
const lowerPlot = Line("bb-lower", { x1: 0, y1: 0, x2: 0, y2: 0, color: "#3b82f6FF" });
const bandFill  = LineFill("bb-fill", upperPlot, lowerPlot, { color: "#3b82f620" });

onBar(() => {
  const bb = ta.bb(ctx.close, 20, 2);
  if (na(bb.upper)) return;

  upperPlot.set({ x1: 0, y1: bb.upper, x2: ctx.i(), y2: bb.upper });
  lowerPlot.set({ x1: 0, y1: bb.lower, x2: ctx.i(), y2: bb.lower });
});

Line

Line entity - both source lines for LineFill must be Line handles.

fill() primitive

fill() shades between two plot series (not Line entities).

Bollinger Bands example

Full working BB with LineFill shading.