priceRange

The Price Range tool measures the vertical distance (price change) between two points. It’s perfect to quickly see how much a move gained/lost (in price units), and you can add a label so it’s readable at a glance.

Syntax (one line)

priceRange(fromPoint, toPoint, styles?)

Parameters

fromPoint (PricedData) · First anchor (time & price) where the measurement starts. toPoint (PricedData) · Second anchor (time & price) where the measurement ends. styles (PriceRangeLineToolOverrides) · Visual and label options:

  • backgroundColor (RGBAColor | BaseColors) · Fill color behind the range.

  • bold (boolean) · Make label text bold.

  • color (RGBAColor | BaseColors) · Line/outline color of the range.

  • extendLeft (boolean) · Extend the range box/line to the left.

  • extendRight (boolean) · Extend the range box/line to the right.

  • fillBackground (boolean) · Fill the background of the range area.

  • fillLabelBackground (boolean) · Fill the label’s background box.

  • fontSize (number) · Base font size for text.

  • italic (boolean) · Italicize label text.

  • labelBackgroundColor (RGBAColor | BaseColors) · Color for the label’s background.

  • labelFontSize (number) · Font size for the label.

  • labelTextColor (RGBAColor | BaseColors) · Text color inside the label.

  • linewidth (number) · Thickness of the range outline.

  • showLabel (boolean) · Show/hide the label that displays the measured value.

  • textcolor (RGBAColor | BaseColors) · Text color (general, if supported by your theme).

  • transparency (number) · Transparency for fills (0=opaque, 100=fully transparent).

Return Value

(string) · The drawing ID of the created Price Range.

Example

What this does: Every 48 candles, it measures the price move from a past swing low to a recent swing high, fills the box softly, and shows a clear label.

Tips

  • Use swing lows/highs for fromPoint and toPoint so the range reflects a meaningful move.

  • If the label overlaps candles, lower labelFontSize or raise transparency for a lighter fill.

  • Turn on extendRight to keep the box visible as new bars print.

Warning

  • Don’t pass raw time() or price numbers directly—always wrap anchors using newPoint(time(offset), priceValue) or nothing will draw.

Good Practice

  • Keep a small set of presets (e.g., blue for bullish legs, red for bearish legs) to recognize ranges quickly.

  • Pair Price Range with dateRange or dateAndPriceRange to see both the duration and the size of a move.

Last updated