OPEN-SOURCE SCRIPT
ที่อัปเดต:

Pivot Range (CPR) with Next-Day Prediction

1 765
📌 Pivot Range (CPR) with Next-Day Prediction

This indicator plots the Central Pivot Range (CPR) based on Mark Fisher's Pivot Range methodology, with a key enhancement — it previews tomorrow's CPR as soon as the current trading session ends, so you don't have to wait for the next day's first candle.

How it works:

- During market hours: Displays today's CPR (Pivot, BC, TC) calculated from the previous day's High, Low, and Close.
- On the last candle of the session: Automatically switches to show tomorrow's CPR using the current day's completed HLC data.

What is CPR?
The Central Pivot Range consists of three levels:

- Pivot (P) = (High + Low + Close) / 3
- Bottom Central (BC) = (High + Low) / 2
- Top Central (TC) = (Pivot − BC) + Pivot

CPR helps identify key support/resistance zones, trend direction, and potential breakout/reversal areas for the upcoming session.

Features:
✅ Next-day CPR prediction right at session close — no waiting until market open
✅ Toggle daily pivots on/off via settings
✅ Works on any intraday timeframe (1m, 5m, 15m, 1H, etc.)
✅ Works on any market/exchange — session detection is automatic
✅ Pine Script v6

Best used on: Intraday timeframes for day trading and swing trading setups.
Release Note
Minor change
Release Note
────────────────────

Pivot Range — Update: Virgin CPR & Untested Day High/Low

This update adds two untested-level layers on top of the existing Central Pivot Range plots.

Virgin CPR (VCPR)

A day's CPR is virgin when price never traded into it during that day. Those untouched ranges tend to act as magnets — the market often returns to them later, and the reaction on first touch is usually meaningful.

How it's determined

• Throughout each day, the script watches the BC–TC band on a configurable pierce-check timeframe (default 5 min).
• A pierce is registered only when a candle body (open-to-close) enters the band. Wicks are ignored — a spike through the range doesn't disqualify it.
• If the day closes with no body entry, that day's CPR is promoted to a VCPR and drawn forward as a shaded rectangle from the next session's open.

Lifecycle

• Projected for a configurable number of trading days (default 10, weekends and holidays are not counted). Set to 0 to carry it forward indefinitely until it's tested.
• The first wick touch marks it as tested. It stays on the chart for the remainder of that session so you can still trade the reaction, then drops off at the next day's open.

Timeframe independence — the pierce check always evaluates the timeframe you select, regardless of your chart timeframe. On a 2-min chart it still measures true 5-min bodies; on a 15-min chart it drills into the 5-min intrabars. Set the chart wherever you like without changing the definition.

Untested Day High / Low

Every completed session publishes its high and low as naked levels.

• Each line is drawn across its origin session, so that day's own range is visible at a glance, and extends right indefinitely.
• A level is retired on its first wick touch, remaining visible for the rest of the testing day.
• Default is unlimited — untouched levels persist for as long as price stays away from them, which is precisely when they carry the most information.
• A safety cap (default 200 levels) keeps the chart within TradingView's drawing limits by dropping the oldest levels first.

Settings

Both layers are independent and fully toggleable, with configurable colours, line width, line style, forward-day counts and optional dated labels ( VCPR 20-Aug ,  DH 20-Aug ,  DL 20-Aug ).

Notes

• Day ranges are built from your chart's bars, so they follow your Regular vs Extended Trading Hours setting. Use Regular Trading Hours for a clean session high/low.
• The original Central Pivot Range plots are unchanged.

The pivot range concept is from Mark Fisher's The Logical Trader. The virgin CPR concept was popularized by Frank Ochoa in Secrets of a Pivot Boss.

────────────────────
Release Note
Virgin CPR rectangles previously ended at the current candle. They now extend to the right past the last bar, matching how the untested day high/low lines are drawn.

The practical benefit is that an untested CPR stays visible ahead of price rather than sitting behind it. When the market is approaching a virgin zone, you can see the band it's heading into instead of having to infer it from where the rectangle stopped.

Nothing about the zone logic has changed — a VCPR is still qualified the same way, still expires on its configured day count, and is still retired on the first wick test.

New setting: Extend Rectangle Right (Virgin CPR group, enabled by default). Turn it off to restore the previous behaviour of ending the rectangle at the current bar.
Release Note
────────────────────

Update: Classic Pivot Points across six timeframes

This release adds a full classic pivot suite alongside the existing Central Pivot Range, virgin CPR zones and untested day high/low levels — so the standard support and resistance grid every desk watches now lives in the same indicator, instead of a second script competing for chart space.

What's new

Classic floor-trader pivots are now plotted for 1 Hour, 4 Hour, Daily, Weekly, Monthly and Yearly. Each timeframe carries its pivot plus R1/S1 and R2/S2. R3 and S3 are available on the two intraday timeframes via their own toggle, matching the convention that the third band is only meaningful within a session.

Every timeframe has an independent on/off switch, so you can run Daily + Weekly + Monthly for swing context, drop to 1H + 4H for intraday work, or layer all six. Daily, Weekly and Monthly are enabled by default; the rest are off so the chart stays readable out of the box.

Colours are grouped by timeframe rather than by side — magenta and red for Daily, dark and light green for Weekly, dark and light blue for Monthly — with the pivot drawn at double weight and its R/S bands at single weight. At a glance you can tell which degree of trend a level belongs to without reading the legend. Every plot remains fully customisable from the Style tab.

Two optional extras are carried over from the original: a 3-period Pivot Average, and a Filtered Pivots mode that selects the R1/S1 formula from the pivot's direction and suppresses R2/S2. Both are off by default.

Notes

The existing CPR toggle is now titled "Show Daily CPR?" and sits in its own Central Pivot Range section, to distinguish it from the new "Show Daily Pivots?" classic-pivot switch. If you had that setting saved, it will return to its default (on).

Classic pivots use the previous period's high, low and close, so each level is fixed for the whole of its period and never repaints.

Credit to ChrisMoody and TheLark for the original CM_Pivot Points M-W-D-4H-1H Filtered, which this section is adapted from. Two defects in that script are corrected here: the 4-Hour S3 plot was gated on the Weekly toggle rather than the 4-Hour one, and the Monthly R1 colour carried a malformed hex value.

────────────────────
Release Note
────────────────────

Update: Virgin CPR pierce rule is now close-based

The test that decides whether a Central Pivot Range stays virgin has been changed from body overlap to closing price.

Previously: a CPR was disqualified if any part of a candle's open-to-close body entered the BC–TC band during its own session.

Now: a CPR is disqualified only if a candle closes inside the band. Wicks into the zone are still ignored, and a bar that opens marginally beyond an edge before reversing away now leaves the level intact.

Why

The body rule turned out to be too strict in exactly the situation the indicator is meant to highlight. A CPR can be respected all session — price rejecting the band on a wick and selling away from it — and still be thrown out because a single follow-up candle opened a fraction of a point inside before reversing. On a recent Nifty session a zone was lost to a 0.76-point penetration on a band almost 27 points wide, despite price never once closing near it.

An open beyond a level that gets immediately rejected is the level being defended, not broken. Requiring a close inside the band lines the rule up with how naked POC and other untested levels are conventionally treated: the level holds until price can actually settle through it.

Impact

Expect somewhat more virgin zones to survive, particularly on volatile sessions where the band is tested repeatedly without being accepted. No settings were added or removed. The Pierce-Check Timeframe input is unchanged in behaviour and still defaults to 5 minutes — only its description has been updated to reflect the new rule.

One trade-off to note: because the test now looks only at the close, a candle that opens below the band, spikes clean through it and closes back below will no longer count as a pierce. On a 5-minute check timeframe that is uncommon and typically news-driven, but it is the one case where the old rule was stricter.

────────────────────

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน