Adaptive Round Number Grid

Round numbers act as reference points on every chart, but a fixed grid of 10 or 100 points is far too tight on one symbol and far too wide on another. This script draws round number lines whose spacing follows the symbol's own daily range, and tells you how far each line sits from price.

Pivot points and levels, published November 24, 2026. Free and open source.

Chart on TradingView with Adaptive Round Number Grid added

What it shows

  • Dashed horizontal lines at round numbers, extended across the whole chart. By default there are 6 lines above and 6 below the last close.
  • A label at the right edge of each line with its price and its distance from the last close in daily ranges, for example +0.50 R. R means the median daily range.
  • Lines within a quarter of a daily range of the last close are drawn in amber. The others are grey.
  • An alert named "Grid step changed" that fires when the spacing moves to a new round value.

How it works

The script takes the high minus low of each completed daily bar and finds the median over the "Range lookback (days)" input, default 60. The current day is left out, so the median does not change while the day is open. It divides that median by the "Spacing divisor" input, default 2, to get a target spacing. The step is then the value of the form 1, 2 or 5 times a power of ten that sits closest to the target, compared on a log scale. Lines are drawn at multiples of the step around the last close, and the number of lines each side is set by "Lines each side". Each label shows the line price minus the last close, divided by the median daily range.

How to use it

  1. Add the script to any chart. It reads daily data whatever the chart timeframe is.
  2. Raise the spacing divisor for a denser grid or lower it for a wider one.
  3. Use the labels to compare distances across symbols, since 1.00 R means one typical day of movement on every chart.
  4. Turn off "Show distance labels" if you only want the lines.

Why it is different

The spacing comes from the symbol's own median daily range and snaps to 1, 2 or 5 times a power of ten. The same settings give readable lines on a stock near 0.80, a coin near 70000 and an index near 5000. The distance label is in daily ranges, so a line's distance means the same thing on each of them.

Limits

  • The step is computed from daily data. A symbol with few daily bars gives no grid until enough history loads.
  • The lines and labels are redrawn on the latest bar, so they move with the last close and the median as new days complete.
  • The median updates once a day when a daily bar completes. When it does, the step can move to a new round value and the whole grid is redrawn at the new spacing.
  • Lines at or below zero are skipped, so a symbol priced close to zero shows fewer lines below price.
  • Each daily range is that day's high minus low. A jump from the prior close to the open is left out of it unless the day's high or low reaches it.
  • It draws on the chart only. It places no orders and is not advice about any trade.