Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

Daily Volume Profile Pro [WillyAlgoTrade]

author EAcpu | 4 reads | 0 comments |
I found this on TradingView and converted the open source Pine script code to MT4 code.

Original code with all details: https://www.tradingview.com/script/O...llyAlgoTrader/

Daily Volume Profile Pro is an overlay indicator that builds a complete volume profile for each daily session - allocating volume between price bins using candle range proportional allocation, calculating POC (Point of Control), 70% value area (VAH/VAL) using the CME extension method, session VWAP, buy/sell delta per bin, and displays the profile for up to 7 days simultaneously. The indicator also detects naked (unvisited) POC from previous days, classifies daily profile shapes (normal/trending/neutral/double distribution), tracks initial balance ranges, and highlights single-print thin volume areas - creating a complete volume-based market environment tool.

Why these components work together

Volume profiles alone show where trading activity is concentrated - but without context, you don't know whether the profile represents a trend day, a balance day, or a dual distribution day. You don't know if the POC from two days ago has been revisited. You don't know if the current price is above or below the initial balance - it tells you if the opening range has been broken.

The indicator is layered across multiple volume-based analyses, each answering a different question:

Volume Profile → Where is the volume concentrated? Which prices are accepted (large quantities) and rejected (small quantities)?
POC → What is the most expensive price in a single transaction? This is the market "fair value" on that trading day.
Value Area (70%) → Where is 70% of the volume? Price within VA = balance. Price outside of VA = Imbalance in search of new value.
Delta Coloring → At each price level, is activity dominated by buyers or sellers? Green box = buying pressure, red = selling.
Naked POC → Which day-ahead fair values ​​are never revisited? These are powerful magnets - prices tend to come back to unfinished business.
Initial balance → What is the opening range? Price above IB high = bullish conviction. Below IB low = bearish. Internal = Balance.
Day type → What shape is the silhouette? Trend days (narrow) behave differently than normal (bell curve) or bidistribution (bimodal) days.
Single Sheet Print → Where does the price move too fast and the trading volume cannot be filled? These thin volume areas are gaps in the silhouette that are often revisited.

No single component can provide the complete picture. The portfolio tells you: the market's fair value (POC), acceptable range (VA), directional pressure (Delta), day characteristics (day type), opening bias (IB), outstanding levels from previous trading days (naked POC), and price imbalances (single print) - all from volume data.

what makes it so original

Candle range proportional volume distribution.
The volume of each candle is distributed across the price ranges it touches, proportional to the range of the candle and the overlap between each range:

Overlap = max(0, min(candle_high, bin_high) − max(candle_low, bin_low))
Allocation Volume = Total Volume × Overlap/Candle Range

This results in a smoother and more accurate profile than the common method of assigning all volume to a single price (the closing price or the typical price). Candles spanning 5 bins have their volume distributed across all 5 bins, weighted by the number of candles that fall in each bin.

Buy/sell classification: closing price ≥ open → buy candle (volume added to buy array), closing price < open → sell candle (volume added to sell array). The Delta color shows whether each bin is dominated by buying or selling pressure.

CME-style value zone expansion.
The 70% value area is calculated using the standard CME method:
— Start with the POC bin — Compare the volume of the next bin above to the next bin below — Expand to the larger side — Repeat until 70% of total sessions are captured
— VAH = top of highest containing bin, VAL = bottom of lowest containing bin

This is in line with industry standard methodologies used by CME Group and professional platforms. VA is displayed as a dashed line (VAH/VAL) with an optional semi-transparent background fill.

Naked POC detection via historical scans.
For the previous day's POC, the indicator scans all bars from the day of POC until now — checking if the price has ever touched that level (low ≤ pocPrice ≤ high). If no bars touch it, the POC is classified as "naked" (nPOC) and is drawn as a dashed red line extending to the right.

A naked POC represents unfinished business - the market determined fair value at that price but never returned to retest it. They act like powerful magnets because the institutional activity that established the original POC may still hold positions anchored at that level. To maintain performance, scanning is limited to 300 bars.

Classify day types based on outline shape.
Analyze daily volume distribution to classify sessions:

Trend : Important bins < 35% of total bins — Volume is concentrated in a narrow area, price moves decisively in one direction — Neutral : Significant bins > 65% — Volume is evenly distributed throughout the range, balancing/rotating days — Normal : 35–65% — Bell curve distribution with clear POC and tapered tails — DD (Double Distribution) : Important bins are concentrated in the top and bottom thirds, but not the middle — Bimodal distribution, representing two independent regions of values (for example, gap-and-go)

A "critical bin" is defined as a volume > 25% of the POC volume. Categories appear as color-coded labels above each conversation.

Initial Balance (IB) range tracking.
IB captures the highest and lowest prices for the first N minutes of each trading session (configurable: 30, 60, 90 or 120 minutes). The IB range is drawn as a solid line with optional background fill, optionally extending to the end of the session.

IB Background: Prices above IB highs indicate early buyers are committed and the market accepts higher prices - a bullish bias. Prices below the IB low send the opposite signal. IB internal price = range-bound. The dashboard shows the current IB position (IB Above/IB Below/IB Inside).

Single print (thin roll) area detection.
Boxes that are less than 15% of the POC box volume are classified as single prints, an area where prices move too quickly to build up significant volume. These areas are highlighted with a unique border color and represent areas of imbalance that are often revisited when the market seeks to fill volume gaps.

Multi-day profile display with configurable direction.
Up to 7 days of left or right contours can be drawn simultaneously. The daily profile bins are scaled: Bin Width = Volume / Max Volume × Span / 3 (in bars). Adaptive bin counts adjust based on the day's price range: bins = min(binCountInput, max(8, range / (ATR × 0.05))).

POC extension + previous day POC (yPOC).
The daily POC can be extended forward 1-7 days (configurable) as a dotted line to serve as a reference level for subsequent sessions. Yesterday's POC (yPOC) is plotted separately as a marker reference - one of the most watched volume levels in professional trading.

Today's POC, VAH and VAL can be extended to the right edge of the chart for real-time reference.

Session Volume Weighted Average Price (VWAP).
Volume weighted average price calculated per session: VWAP = Σ(Typical Price × Volume) / Σ(Volume). Shown as a dashed line in each session. VWAP represents the average price of trading volume and is an important reference for institutional traders.

Optional MA overlay.
Six MA types are provided (SMA, EMA, RMA, WMA, VWMA, None) to provide additional trend context beyond the volume overview.

How it works - Calculation process

Step 1 - Session Detection: Track daily changes via ta.change(time("D")). Session start/end bars, daily high/low and timestamps stored in arrays. Track IB highs/lows during the first N minutes of each trading session.

Step 2 - Profile Building (Daily): For each session, the price range is divided into different intervals. Each candle in the session distributes its volume across the bins, proportional to the degree of overlap of the candle ranges in each bin. Separate buy and sell arrays track directional volume.

Step 3 - POC/VA/VWAP: POC = Maximum Capacity Box. VA is calculated from POC through CME extension until 70% is captured. VWAP = cumulative (typical price × trading volume) / cumulative trading volume.

Step 4 - Visualization (last column): All outlines, lines and labels are drawn on barstate.islast using delete and redraw mode. Profile boxes are colored by delta (buy/sell dominance), POC boxes are highlighted, VA boxes are colored, and single sheets are printed with borders.

Step 5 - Bare POC Scan: Each previous day's POC is checked against all subsequent bars. If no bar touches this level → the bare POC is drawn as a dotted line.

Step 6 - Day Type: Analyze volume distribution for shape classification (Trend/Normal/Neutral/DD).

How to use

Quick start:
1. Add indicators to the intraday chart (1M–30M recommended)
2. Show volume overview for each daily session (up to 7 days)
3. Yellow horizontal line = POC (highest volume and price)
4. Blue dashed line = VAH / VAL (70% value area boundary)
5. Red dotted line = Naked POC from previous days (unvisited fair value)
6. Orange line = Initial balance high/low

Read the chart:
— Solid line = POC (fair value of session)
— Dashed line = extended POC (reference for future meetings)
— Dashed line with label “nPOC” = naked POC (not visited — strong magnet)
— “yPOC” tag = yesterday’s POC
— Dashed line = VAH / VAL (70% value area boundary)
— Shaded area = Value area background — Dashed line = Session VWAP
— Solid line = IB High / IB Low — Shaded area = Initial Balance Range — Profile Box = Buying Pressure (Delta Positive)
— Profile box = selling pressure (negative delta)
— Bordered box = single print (thin volume - unbalanced area)
— Day type tags: Trend/Normal/Neutral/DD

Dashboard fields:
— Day Type: Contour shape classification (trend/normal/neutral/DD)
— Trend: Price vs POC (Bullish ▲ / Bearish ▼)
— Price zones: above VA/inside VA/under VA — IB positions: above IB / inside IB / below IB — POC: today’s price, distance from POC — VAH/VAL: value zone boundaries — Delta: net buy/sell percentage — Volume: total session volume — Naked POC: number of POCs not visited on the previous day

Tuning Guide:
—The outline is too rough: add profile boxes (30–40)
—Profile too granular: reduce profile boxes (15–20)
—Want to see more history: increase the number of display days (up to 7 days)
IB is too narrow for your market: increase IB time (90–120 minutes)
Too many single prints: This is informational — they emphasize the real imbalance

Button setting reference

main:
—Number of showing days (default 7): Number of profiles per day (1–7)
—Archive bin (default 34): resolution of volume distribution

Introduction:
—Delta coloring (default on): color-sorts bins by buy/sell pressure —Sheet printing (default on): highlights low volume imbalance areas (<15% of POC)
—Side (default left): Draws the bar chart on the left or right side of the session

level:
POC (on by default) width and expansion (1-7 days)
—Naked POC (enabled by default): POC not visited the previous day
Value area (default on) with background fill — Session volume weighted average price (default off)
Previous day POC (default enabled): yPOC reference — Today’s extension (default enabled): Extend the current session level to the edge of the chart

Initial balance:
IB session (default 60 minutes): 15–120 minutes — IB background (default on)/ extended IB line (default on)

Visual effects:
— Date separator, date label (Monday to Sunday), date type label — MA overlays: SMA/EMA/RMA/WMA/VWMA/None — Auto/Dark/Light themes

alarm

— POC CROSS DOWN — Price crosses with today’s POC — VAH BREAK — Price breaks above value zone high — VAL BREAK — Price breaks below value zone low

Important notes

—Use within the intraday time frame. This indicator builds a daily session profile - it requires intraday data (1M-30M recommended) to produce meaningful volume distribution. On daily or higher timeframes, there is only one candle per day, resulting in a single box profile.
—No need to repaint. All alert conditions require barstate.isconfirmed. Profiles are calculated based on historical data from each session. Today's profile is updated in real time when a new bar arrives (this is the expected behavior of a live volume profile - not a redraw).
— Volumes are distributed proportional to the candle range overlap , rather than tick by tick. Real scale data is not available in Pine scripts. This candle range method produces an approximation of the intraday time range (1M–15M). Shorter time frame = more candles per session = more accurate overview.
— The value area uses standard CME expansion methods : starting from the POC and expanding toward higher capacity adjacent bins until 70% is captured. This matches industry standard algorithms used by professional platforms.
— Naked POC scan checks up to 300 history records per POC for performance reasons. On very short timeframes with many bars per day, POCs older than 5 days may be out of the scan range.
— Single prints are defined as zones with volume < 15% of POC volume — These represent areas where price moves too quickly to accumulate meaningful volume. They are not errors or missing data.
— Day type classification uses volume distribution shape analysis based on the ratio of important bins to total bins. This is a probabilistic assessment of the characteristics of the trading session rather than a definite market prediction.
— This is a volume analysis and market background tool , not an automated trading system. It visualizes trading volume, which prices were accepted/rejected and which levels were not completed - trading decisions remain up to you.
— Volume data required. On instruments without reliable trading volumes (certain FX pairs), the accuracy of the profile depends on the quoted trading volume reported by the broker.

Attached picture (click to enlarge)
Click to Enlarge

Name: Daily Volume Profile Pro.png
Size: 43 KB


//+------------------------------------------------------------------+
// Precautions for using MT4
//+------------------------------------------------------------------+
//
// 1. TIMEFRAME: Attached to intraday chart (recommended M1–M30).
// Generate single position configuration files for daily or higher time ranges.
//
// 2. VOLUME: Use tick_volume[] (broker quote count), which is
// For most instruments, trading volumes are only available in MQL4.
// For futures/stocks with real volume, tick_volume will equal the volume.
//
// 3. Session detection: Use the server to detect day boundaries
//Calendar time. If your broker's day starts at a different time
// After midnight, the session will still be properly aligned with the calendar
// Number of days for broker server time reporting.
//
// 4. NAKED POC SCAN: Check up to 300 histograms per POC
//Performance. On a very short time frame with many bars per day,
// POCs >5 days old may fall outside the scan window.
//
// 5. Color rendering: MQL4 rectangles are completely opaque. virginia
//Use highly bright colors for background and IB background
// Approximate translucent filling of Pine script
//Original. Enable "Draw on Background" (OBJPROP_BACK=true)
// So the profile bar is rendered behind the candlestick.
//
// 6. Performance: Full session scan + profile rebuild only runs on
// Formation of new bar. The dashboard is updated every time it is updated.
// On M1 with 7 days of data (~3360 entries), reconstruction is usually done
// Completed in < 50 ms.
//
//+------------------------------------------------------------------+
Daily Volume Profile Pro.pngdv.jpgImage_1776946016119_142.png
Daily Volume Profile Pro.pngdv.jpgImage_1776946016119_142.png
Daily Volume Profile Pro.pngdv.jpgImage_1776946016119_142.png
Daily Volume Profile Pro.pngdv.jpgImage_1776946016119_142.png
Daily Volume Profile Pro.pngdv.jpgImage_1776946016119_142.png
Daily Volume Profile Pro.pngdv.jpgImage_1776946016119_142.png

Attachment to original post (1)

📦 Summary of post attachments (1)

Below are all the files shared in the reply (1).

Verification code Refresh