Wraith Protocol | PUT & CALL VP LevelsThis is a dual Volume Profile indicator built in Pine Script v5. It computes two independent volume profiles — one for a "PUT" lookback window and one for a "CALL" lookback window — and extracts the three key auction market theory levels from each: the Value Area High (VAH), the Point of Control (POC), and the Value Area Low (VAL). These levels are drawn as persistent horizontal lines across the chart with labeled price annotations, a colored histogram, and a summary data table.
The PUT and CALL naming convention frames these levels as options-market analog reference zones — the PUT profile represents a longer-term bearish/support structure, while the CALL profile represents a shorter-term bullish/resistance structure. Neither pulls actual options data; the names are a conceptual framing applied to standard price/volume data.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Section-by-Section Breakdown
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1. Inputs
Volume Profile group:
Profile Rows — how many horizontal price buckets to divide the range into (default 24). More rows = finer resolution.
Histogram Max Width (bars) — the visual width of the histogram in bar units (default 30).
Show Histogram — toggle the visual bars on/off.
PUT Levels group:
PUT Lookback Bars — how many bars back to include in the PUT profile (default 150, i.e. a longer-term window).
PUT Value Area % — the percentage of total volume that defines the Value Area (default 70%). Standard TPO/VP convention uses 70%.
Show PUT Levels — toggle all PUT lines/labels on/off.
PUT VAH / POC / VAL color pickers — individual line color controls.
CALL Levels group:
Same structure as PUT but defaults to a shorter 70-bar lookback. This creates a faster-moving, nearer-term profile.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Style group:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Extend Lines Right — extends all lines to the right edge of the chart (infinite extend).
Label Size — controls the text size of all price labels (tiny → huge).
2. Volume Profile Engine (same logic runs twice — for PUT and CALL)
Step 1 — Find the high/low range of the lookback window.
The script loops backward over the specified number of bars and finds the highest high and lowest low in that window. This becomes the price range for the profile.
Step 2 — Distribute volume into rows (buckets).
The range is divided into rows equally-spaced price buckets. For every bar in the lookback window, its volume is distributed proportionally across whichever buckets its high-low range overlaps. The formula is:
allocated volume = bar volume × (overlap length / bar range)
If a bar's range is zero (doji), it uses the bucket step size as a fallback to avoid division by zero.
Step 3 — Find the POC.
The bucket with the highest accumulated volume is the Point of Control (POC) — the price level where the most trading activity occurred.
Step 4 — Build the Value Area.
Starting from the POC, the script expands outward one bucket at a time, always adding the larger neighbor first (up or down), until the cumulative volume in the growing range reaches the target Value Area % of total volume. The top of the upper boundary is the VAH; the bottom of the lower boundary is the VAL.
3. Histogram Drawing
On the last bar (barstate.islast), old histogram boxes are deleted and new ones are drawn. Each row gets a colored box whose width is proportional to its volume relative to the max-volume row. Opacity varies by context:
POC row → fully opaque (transparency = 0)
Inside Value Area → semi-transparent (40)
Outside Value Area → mostly transparent (70)
PUT histogram uses red; CALL histogram uses teal. Each starts at bar_index - lookback + 1 so the histogram aligns to its respective lookback window.
4. Lines & Labels
All six lines (PUT VAH/POC/VAL, CALL VAH/POC/VAL) are deleted and redrawn on every last-bar execution, which means they update in real time as new bars form.
VAH lines — solid, width 2, extending right
POC lines — dashed, width 2, extending right
VAL lines — solid, width 2, extending right
Labels are placed at histogram_left + histogram_width + 1, i.e. just to the right of each histogram. Label text includes a human-readable role name ("PUT VAH DN SELLER EXIT", "PUT VAL BUYER EXIT", "CALL VAH BUYER EXIT", "CALL VAL DN SELLER EXIT") plus the live price value formatted to 2 decimal places.
The label role convention follows auction market logic:
Level Interpretation PUT VAHDownside seller exhaustion — sellers who pushed price into the PUT range may exit here PUT VAL Buyers who entered in the PUT range may exit here CALL VAH Buyers who pushed price into the CALL range may exit here CALL VAL Downside sellers may exit here, near the base of CALL value
5. Data Window Plots
Six plot() calls with display=display.data_window expose all six levels in TradingView's Data Window panel. They are not drawn on the chart (no display.pane) — they exist purely for external access, alerts, or Pine Strategy consumption.
6. Info Table (Bottom Right)
A persistent 3-column × 8-row table summarizes everything in one glance:
Row Content Header "Level", "PUT (Nb)", "CALL (Nb)"VAHPUT and CALL VAH prices POC PUT and CALL POC prices VAL PUT and CALL VAL prices Spread VAH − VAL for each profile (range of the Value Area)PUT Bias "ABOVE POC" / "BELOW POC" relative to current close — green or red CALL Bias Same for CALL profile VA %The configured value area percentage for each profile
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Key Design Decisions:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Why barstate.islast only? Volume profiles are computationally expensive. Running them on every bar would be slow and generate thousands of orphaned drawing objects. By running only on the last bar and deleting/redrawing all objects, the script stays clean and efficient.
Why two separate lookbacks? The asymmetry between a 150-bar PUT profile and a 70-bar CALL profile is intentional. It creates structural levels at two different temporal horizons — analogous to how options traders think about near-term (gamma) vs. longer-term (delta) positioning zones.
Why var declarations for lines/labels? var preserves the last-assigned object reference across bars so the script can explicitly delete the previous versions before drawing new ones — preventing object accumulation.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Usage Notes:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Works on any instrument and timeframe; the lookback bars are bar-count based, not time-based.
Lowering Profile Rows to 10–15 gives broader, more tradeable zones. Increasing it to 40+ gives precision but may over-fit to noise.
The "Extend Lines Right" toggle is useful when you want clean horizontal levels extending into the future for forward reference.
The PUT/CALL bias rows in the table provide a quick structural read: if price is above both POCs, the profile structure is broadly bullish; below both is broadly bearish; split is a contested/transitional market.
Ref: My previous Script- Wraith Protocol
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
IMPORTANT NOTES
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
• This indicator is for informational and educational purposes only.
It does not constitute financial advice.
• Past performance of any level or signal does not guarantee future results.
• Always use proper risk management and combine with your own analysis.
• The Estimate field is a directional bias tool, not a trade signal.
• Best used as a confluence layer alongside your primary strategy. Enjoy !!
Pine Script®指标












