OPEN-SOURCE SCRIPT
Previous Day Value Area - CriptoMatiko

## Description
The **Previous Day Value Area** replicates, bar-for-bar, the exact volume-area calculation used in our own Python volume profile backtester. Every VAH/POC/VAL value this indicator plots can be checked line-by-line against the backtester's output — that's the reason this exists: TradingView's native Volume Profile does its own internal binning, which you can't inspect or reproduce outside the platform. This one gives you a value area you can actually verify.
---
**How it works**
1. Pulls 1-minute bars for each session (`request.security_lower_tf`).
2. Splits each 1-minute bar's volume evenly across every price bucket its high-low range touches ("bar-distributed" volume) — same method as the Python backtester, not TradingView's built-in binning.
3. POC = the price bucket that accumulated the most volume.
4. Expands outward from the POC toward the heavier side until 70% (configurable) of the day's total volume is captured. The two edges of that range are VAL and VAH.
5. Bucket resolution is fixed once at session open and held constant until the session closes, so keys never shift mid-calculation.
---
**Visuals**
- Lines — the previous day's VAH / POC / VAL, projected across the current session (what a systematic detector would read)
- Optional histogram — the volume profile silhouette for each session, drawn as a mirrored buy/sell split
- Comparison mode — draws the value area over the same day that produced it, for side-by-side visual checks against other volume-profile tools
- Table (top-right) — previous day's date, VAH, POC, VAL, plus the current (in-progress) session's values
---
**Parameters**
- Value area %: percentage of volume captured between VAL and VAH (default 70%)
- Profile resolution: automatic (% of price), fixed bucket size, or rows based on D-1's range
- Project D-1 value area: shows the previous day's finished levels across the current session
- Comparison mode: draws the levels on the day that generated them instead of projecting forward
- Histogram rows / width: controls the resolution and size of the drawn volume profile
- Split buy/sell volume: separates the histogram into up-close and down-close volume
---
**Originality**
This is not a variant of the built-in Volume Profile — it's a from-scratch bar-distributed volume calculation written to match a specific Python backtesting pipeline, so that value-area levels computed in code and value-area levels seen on the chart are provably the same numbers.
---
**Credits**
Author: Vernon CriptoMatiko
The **Previous Day Value Area** replicates, bar-for-bar, the exact volume-area calculation used in our own Python volume profile backtester. Every VAH/POC/VAL value this indicator plots can be checked line-by-line against the backtester's output — that's the reason this exists: TradingView's native Volume Profile does its own internal binning, which you can't inspect or reproduce outside the platform. This one gives you a value area you can actually verify.
---
**How it works**
1. Pulls 1-minute bars for each session (`request.security_lower_tf`).
2. Splits each 1-minute bar's volume evenly across every price bucket its high-low range touches ("bar-distributed" volume) — same method as the Python backtester, not TradingView's built-in binning.
3. POC = the price bucket that accumulated the most volume.
4. Expands outward from the POC toward the heavier side until 70% (configurable) of the day's total volume is captured. The two edges of that range are VAL and VAH.
5. Bucket resolution is fixed once at session open and held constant until the session closes, so keys never shift mid-calculation.
---
**Visuals**
- Lines — the previous day's VAH / POC / VAL, projected across the current session (what a systematic detector would read)
- Optional histogram — the volume profile silhouette for each session, drawn as a mirrored buy/sell split
- Comparison mode — draws the value area over the same day that produced it, for side-by-side visual checks against other volume-profile tools
- Table (top-right) — previous day's date, VAH, POC, VAL, plus the current (in-progress) session's values
---
**Parameters**
- Value area %: percentage of volume captured between VAL and VAH (default 70%)
- Profile resolution: automatic (% of price), fixed bucket size, or rows based on D-1's range
- Project D-1 value area: shows the previous day's finished levels across the current session
- Comparison mode: draws the levels on the day that generated them instead of projecting forward
- Histogram rows / width: controls the resolution and size of the drawn volume profile
- Split buy/sell volume: separates the histogram into up-close and down-close volume
---
**Originality**
This is not a variant of the built-in Volume Profile — it's a from-scratch bar-distributed volume calculation written to match a specific Python backtesting pipeline, so that value-area levels computed in code and value-area levels seen on the chart are provably the same numbers.
---
**Credits**
Author: Vernon CriptoMatiko
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.