OPEN-SOURCE SCRIPT

Prior Range XL

364
**Prior Range XL — Overview**

Prior Range XL plots the previous period's trading range directly on the chart and marks the key levels inside it. It answers a simple question at a glance: where did price trade last period, and where are the meaningful levels within that zone? The prior high and low from a higher timeframe (day, week, or month) often act as support, resistance, and targets in the current period, and this tool keeps them visible and updated without manual drawing.

**What it draws on the chart**

- **Range box** — a shaded rectangle spanning the prior period's high down to its low, giving an immediate visual sense of the zone price is working within.
- **Prior High line** — the top of the range, extended across the current period.
- **Prior Low line** — the bottom of the range, extended across the current period.
- **Midline** — the exact midpoint (50%) of the range, often treated as the "fair value" or equilibrium of the zone.
- **Two internal levels** — user-placed lines inside the range (defaults sit at 20% and 80%), useful for spotting partial retracements, entries, and profit zones between the extremes.

All lines and the box extend to the right and refresh as the current period develops. Range values are calculated from the regular trading session only, so overnight or extended-hours spikes don't distort the prior high and low.

**The inputs, grouped**

*Structure*
- **Structure Timeframe** — the heart of the tool. Choose Daily, Weekly, or Monthly to decide which prior period defines the range. Daily uses yesterday's range, Weekly uses last week's, Monthly uses last month's. This should be set at or above the chart's timeframe for correct behavior.

*Internal Levels*
- **Show Internal Level 1 / Level 2** — toggles each of the two inner lines on or off.
- **Level 1 Value / Level 2 Value** — sets where each inner line sits within the range on a 0-to-1 scale. Zero is the range low, one is the range high, and 0.5 is the midpoint. Setting a level to exactly 0.5 hides it, since the dedicated midline already covers that spot.

*Colors*
- **Box Fill Color** — the shade and transparency of the range rectangle.
- **Box Border Color** — the outline of the box.
- **Prior High Line Color** — color of the top line (labeled PDH).
- **Prior Low Line Color** — color of the bottom line (labeled PDL).
- **Midline Color** — color of the 50% line.
- **Internal Level Color** — color applied to both inner levels.

*Lines & Styles*
- **Line Width** — thickness of the box border and every line.
- **Midline Style** — solid, dashed, or dotted for the midpoint line.
- **Internal Level Style** — solid, dashed, or dotted for the two inner levels.

**How to use it**

- **Frame the session** — set the Structure Timeframe to the period that matters for the trading approach. Intraday traders typically use Daily; swing traders lean toward Weekly or Monthly.
- **Read the edges** — the prior high and low act as natural decision points. Price approaching an edge often stalls, reverses, or breaks through with momentum, and either outcome is tradable information.
- **Use the midline as a pivot** — trading above the midline leans bullish within the range; below it leans bearish. It's a quick read on which half of the zone price favors.
- **Place the internal levels intentionally** — the defaults at 20% and 80% highlight the outer quarters of the range, a common area for reactions before price tests the extremes. Adjust them to match a preferred method, such as thirds or a specific retracement depth.
- **Style for clarity** — assign distinct colors so the high, low, midline, and internal levels are instantly distinguishable, and use dashed or dotted styles to keep the inner lines from competing visually with the range boundaries.

**One practical note**

Because the title is "Prior Range XL," the chart platform treats it as its own indicator. Any earlier version under a different name stays separate and should be removed manually to avoid overlapping boxes and lines.

*(This description is drawn entirely from the indicator's own settings and logic — no outside sources involved.)*

Exención de responsabilidad

La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.