dateAndPriceRange
The Date & Price Range tool measures both the time (horizontal) and price (vertical) distance between two points. It’s ideal for summarizing a full move: how long it took and how big it was. Think of it as a combined stopwatch + ruler in one clean box.
Syntax (one line)
dateAndPriceRange(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 (PriceDateRangeLineToolOverrides) · Visual and label options (inherits all from PriceRangeLineToolOverrides, plus border controls):
backgroundColor(RGBAColor | BaseColors) · Fill color behind the range.bold(boolean) · Make label text bold.color(RGBAColor | BaseColors) · Outline/line 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 duration and price change.textcolor(RGBAColor | BaseColors) · General text color.transparency(number) · Transparency for fills (0=opaque, 100=transparent).showBorders(boolean) · Show borders around the range box.borderColor(RGBAColor | BaseColors) · Border color of the range box.borderWidth(number) · Border thickness of the range box.
Return Value
(string) · The drawing ID of the created Date & Price Range.
Example
What this does: Every 50 candles, it measures a move from a past swing low to a recent swing high, fills softly, shows a clear label with time + price, and draws a thin border.
Tips
Pair this with a simple note on your chart (e.g., “3d 6h, +4.2%”) to quickly recall both duration and magnitude.
If labels feel crowded, lower
labelFontSizeor increasetransparencyfor a lighter fill.Turn on
extendRightwhen you want the range box to remain visible as new bars print.
Warning
Don’t pass raw
time()or price numbers directly—always wrap anchors withnewPoint(time(offset), priceValue), or the drawing won’t be created.
Good Practice
Use consistent presets (e.g., blue for bullish legs, red for bearish legs) so ranges are recognizable instantly.
Combine
dateAndPriceRangewith Price Range and Date Range on key moves to compare size vs duration across multiple swings.
Last updated