OPEN-SOURCE SCRIPT

Percent Range Tool

251
  • Percent Range Tool is an overlay indicator that lays a percentage scale over the chart, measured from the current close.
    It's built for anyone who thinks in percentage distances rather than in absolute prices — for judging how far a move would have to carry, for setting targets and stops in percentage terms, or for comparing symbols whose price levels have nothing in common.
    Rather than working from fixed percentage steps that have to be reset for every symbol and every timeframe, the scale sizes itself: it takes the highest high and the lowest low within a lookback window, measures how far each of them sits from the current close, and lets the wider of the two distances stand for one hundred percent. Everything in between is divided into equal steps.
    A single length input therefore governs the entire scale, while its placement and its color stay adjustable.


Calculation

  • Length:
    number of bars searched for the highest high and the lowest low.


Appearance

  • Offset:
    distance in bars between the current bar and the right-hand end of the levels.

  • Extend Levels to the Left:
    carries every level to the left across the whole chart.

  • Line Color:
    color of the lines and of their labels.

  • Label Size:
    font size of the percentage labels.

snapshot

  • The indicator draws twenty horizontal lines, ten above the close and ten below it, each labelled with its percentage at the right-hand end.
    The outermost pair marks the full distance the market covered within the lookback window; from there the levels step inward in equal increments, and their alternating lengths and line styles make the steps easy to count at a glance.
    Since only the wider of the two distances sets that outer edge, the nearer of the two extremes lands somewhere inside the scale rather than on an edge of its own.

  • On higher timeframes the scale often runs wider than one hundred percent, because the distance to the high is open-ended while the distance to the low can never exceed one hundred percent — a price cannot fall further than to zero.
    The levels that would land at or below zero are left out entirely, so on those charts fewer lines appear below the close than above it.

  • The whole block sits to the right of the last candle, in the empty space beyond the current bar rather than over the price action itself, so depending on how much room the chart leaves on the right it may take some scrolling before the levels come into view.
    Extended to the left, they run back across the chart instead, which places every percentage beside the bars it refers to — the staggered lengths then no longer have any effect, and the steps are told apart by line style alone.

  • Only the current state is drawn.
    Nothing is placed on past bars and there is no history to scroll back through: with every new bar the lookback window moves on, and both the close and the two extremes it is measured against can change, so the levels are rebuilt and the percentages on the labels shift with them.
    On the bar still forming they follow the live price and settle once that bar closes.
    Because the scale is derived from the range rather than fixed, its numbers differ from symbol to symbol and from timeframe to timeframe — a quiet market produces a narrow scale, a volatile one a wide scale.

snapshot
snapshot

  • This indicator is intended solely for market analysis and does not constitute investment advice or a guarantee of success.
    Use it at your own discretion and risk; past results are not indicative of future performance.

Aviso legal

As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.