Smart Money Profile puts the four tools that intraday traders combine most often, under the ICT and smart money concepts, into one indicator: a market profile with its point of control and value area, the order blocks left by each break of structure, a daily VWAP with its standard deviation bands, and the London and New York killzones. The VWAP is not just drawn next to the rest: it grades each order block, so the blocks formed on the right side of the average price stand out from the others.
This code is written in ProRealCode Script and runs with ProRealCode Studio on ProRealTime Web.

The profile answers a simple question: at which prices did the market actually trade over the last bars? The range between the highest high and the lowest low of the lookback (300 bars by default) is cut into 48 rows. Each bar adds its volume to every row its range covers, spread evenly between them. When the instrument has no volume, as on most forex CFDs, each bar counts as one unit of time instead, which gives a time-at-price profile (the original market profile idea); the dashboard says which one is used.
The dashboard tells where the close sits: above the value area (premium), inside it, or below it (discount). In ICT terms, a long is best looked for in discount and a short in premium.
Swings are confirmed pivots (5 bars on each side by default), so they never repaint. When a close breaks the last swing high, the structure turns bullish, and the last down candle of the leg that made the break is the bullish order block: the zone where buyers were last absorbing sell orders before pushing price up. The mirror gives the bearish order block: the last up candle before a close below the last swing low.
The VWAP is the volume-weighted average price since the start of the day: the average price paid by everyone who traded today. It is drawn in lilac with its bands at one and two standard deviations, the ±1σ zone lightly shaded. It starts again at each new date.
Each order block is graded against the VWAP at the moment its candle was formed:
A confirmed block is brighter, with a thicker border (thicker again for ★★). A block that is not confirmed stays pale: it formed on the wrong side of the average price, which makes it a weaker zone. The dashboard counts the confirmed blocks on each side, and gives the VWAP with the position of price against it.
The London and New York killzones are the hours where the large moves of the day usually start. They are shaded in blue (London, 08:00 to 11:00) and orange (New York, 13:00 to 16:00). The hours are in chart time, Paris by default, and can be changed in the Variables form. The dashboard shows when a killzone is open.
An alert is sent the first time price tests an order block confirmed by the VWAP, with the side, the price and the VWAP in its message. Unconfirmed blocks raise no alert.
Paste the code into a new Studio tab and run it on an intraday chart, 1 to 15 minutes, of an instrument with volume (index futures, stocks). The profile is drawn to the right of the last bar, so leave some space on the right of the chart. Every setting is a field of the Variables form: the profile’s length, rows, width and position, the volume or time weighting, the swing length, the number of blocks, the killzone hours, the VWAP bands and the three colours of the dashboard.
A typical reading: price pulls back into a bullish order block marked ★ or ★★, below the VWAP and in the discount of the value area, during a killzone. Each of these is a reason, none of them is a signal on its own.

The code also shows several additions of ProRealCode Script: input() with colour fields, a FUNCTION returning three values (the r, g, b of the colour ramp), arrays to keep the order blocks, drawings beyond the last bar, a two-colour COLORBETWEEN, a table with DRAWTABLE, TABLEMERGE, TABLECELL and TABLEBG, and an alert carrying JSON data.
// ============================================================================
// Smart Money Profile
// Market profile, order blocks, VWAP confluence and killzones in one indicator
// ----------------------------------------------------------------------------
// Author: Nicolas — ProRealCode
// Runs with ProRealCode Studio: https://www.prorealcode.com/prorealcode-studio/
// ----------------------------------------------------------------------------
// A market profile of the last bars drawn next to the price, with its point of
// control and its value area, the order blocks left by each break of structure,
// the London and New York killzones, and a daily VWAP with its bands that
// confirms the order blocks sitting on the right side of it. Built with
// functions, arrays, loops, drawings, a table and an alert.
// ============================================================================
input(lookback, 300, "Profile: bars", int)
input(bins, 48, "Profile: rows", int)
input(profWidth, 60, "Profile: width (bars)", int)
input(profRight, 15, "Profile: space after the last bar", int)
input(useVolume, 1, "Weight by volume (0 = time at price)", int)
input(swingLen, 5, "Order blocks: swing length", int)
input(maxBlocks, 4, "Order blocks shown per side", int)
input(lonFrom, 800, "London killzone from (HHMM, chart time, Paris by default)", int)
input(lonTo, 1100, "London killzone to", int)
input(nyFrom, 1300, "New York killzone from", int)
input(nyTo, 1600, "New York killzone to", int)
input(showBands, 1, "VWAP bands (0/1)", int)
input(boardBg, "#120e2a10", "Table background", color)
input(boardHead, "#3a2a80", "Table header", color)
input(boardEdge, "#6c5ce7", "Table border", color)
atr = AverageTrueRange[14](close)
// The profile's colour ramp: violet for thin rows, cyan in between, gold at
// the busiest. A function can return several values: here the r, g, b triplet.
FUNCTION heat(t)
IF t < 0.5 THEN
u = t / 0.5
RETURN 90 - 50 * u, 60 + 130 * u, 190 + 20 * u
ENDIF
u = (t - 0.5) / 0.5
RETURN 40 + 210 * u, 190 + 10 * u, 210 - 140 * u
ENDFUNCTION
// ── 1. Killzones: the two sessions where the big moves usually start ────────
hhmm = FLOOR(time / 100)
IF hhmm >= lonFrom AND hhmm < lonTo THEN
BACKGROUNDCOLOR(90, 140, 255, 16)
ELSIF hhmm >= nyFrom AND hhmm < nyTo THEN
BACKGROUNDCOLOR(255, 170, 60, 16)
ENDIF
// ── 2. The daily VWAP and its bands ─────────────────────────────────────────
// Volume-weighted average price since the start of the day, with one and two
// standard deviations around it. Without volume, every bar weighs the same.
tp = (high + low + close) / 3
vw = 1
IF volume > 0 THEN
vw = volume
ENDIF
newDay = date <> date[1]
IF newDay THEN
sumV = vw
sumPV = tp * vw
sumP2V = tp * tp * vw
ELSE
sumV = sumV + vw
sumPV = sumPV + tp * vw
sumP2V = sumP2V + tp * tp * vw
ENDIF
vwap = sumPV / sumV
sd = SQRT(MAX(0, sumP2V / sumV - vwap * vwap))
up1 = vwap + sd
dn1 = vwap - sd
up2 = vwap + 2 * sd
dn2 = vwap - 2 * sd
lineAlpha = 230
bandAlpha = 120 * showBands
IF newDay THEN
lineAlpha = 0
bandAlpha = 0
ENDIF
IF showBands = 1 AND NOT newDay THEN
COLORBETWEEN(up1, dn1, "#e8a0ff14", "#e8a0ff14")
ENDIF
// ── 3. Swings and breaks of structure ───────────────────────────────────────
ph = PivotHigh[swingLen, swingLen](high)
pl = PivotLow[swingLen, swingLen](low)
IF ISSET(ph) THEN
swingHigh = ph
swingHighBar = barindex - swingLen
highBroken = 0
ENDIF
IF ISSET(pl) THEN
swingLow = pl
swingLowBar = barindex - swingLen
lowBroken = 0
ENDIF
// A close above the last swing high: the last down candle of the leg that
// broke it is the bullish order block. The mirror for a close below a low.
IF swingHigh > 0 AND highBroken = 0 AND close > swingHigh THEN
highBroken = 1
found = 0
FOR k = 1 TO MIN(50, barindex - swingLowBar) DO
IF found = 0 AND close[k] < open[k] THEN
found = 1
ARRAYPUSH($oTop, high[k])
ARRAYPUSH($oBot, low[k])
ARRAYPUSH($oBar, barindex - k)
ARRAYPUSH($oDir, 1)
ARRAYPUSH($oHit, 0)
// Bought below the VWAP: confirmed. Down to the lower band: strong.
ARRAYPUSH($oConf, (low[k] <= vwap[k]) + (low[k] <= dn1[k]))
ENDIF
NEXT
ENDIF
IF swingLow > 0 AND lowBroken = 0 AND close < swingLow THEN
lowBroken = 1
found = 0
FOR k = 1 TO MIN(50, barindex - swingHighBar) DO
IF found = 0 AND close[k] > open[k] THEN
found = 1
ARRAYPUSH($oTop, high[k])
ARRAYPUSH($oBot, low[k])
ARRAYPUSH($oBar, barindex - k)
ARRAYPUSH($oDir, -1)
ARRAYPUSH($oHit, 0)
// Sold above the VWAP: confirmed. Up to the upper band: strong.
ARRAYPUSH($oConf, (high[k] >= vwap[k]) + (high[k] >= up1[k]))
ENDIF
NEXT
ENDIF
// Price comes back into a block: it is tested. A close through it ends it.
// Only the blocks the VWAP confirms raise an alert.
FOR i = 0 TO ARRAYSIZE($oDir) - 1 DO
IF $oDir[i] = 1 AND $oBar[i] < barindex - 1 THEN
IF close < $oBot[i] THEN
$oDir[i] = 0
ELSIF low <= $oTop[i] AND $oHit[i] = 0 THEN
$oHit[i] = 1
IF $oConf[i] >= 1 THEN
alert("Smart money profile", "Price tests a bullish order block confirmed by the VWAP at #close#", onceperbar, 1, {side: "long", price: close, vwap: vwap})
ENDIF
ENDIF
ELSIF $oDir[i] = -1 AND $oBar[i] < barindex - 1 THEN
IF close > $oTop[i] THEN
$oDir[i] = 0
ELSIF high >= $oBot[i] AND $oHit[i] = 0 THEN
$oHit[i] = 1
IF $oConf[i] >= 1 THEN
alert("Smart money profile", "Price tests a bearish order block confirmed by the VWAP at #close#", onceperbar, 1, {side: "short", price: close, vwap: vwap})
ENDIF
ENDIF
ENDIF
NEXT
// Keep the arrays short: the oldest blocks leave from the front
WHILE ARRAYSIZE($oDir) > 100 DO
ARRAYSHIFT($oTop)
ARRAYSHIFT($oBot)
ARRAYSHIFT($oBar)
ARRAYSHIFT($oDir)
ARRAYSHIFT($oHit)
ARRAYSHIFT($oConf)
WEND
// ── 4. On the last bar: the profile, the blocks and the dashboard ───────────
IF islastbarupdate THEN
n = MIN(lookback, barindex)
top = highest[n](high)
bot = lowest[n](low)
stepSize = (top - bot) / bins
// Each bar adds its volume (or one unit of time) to every row it covers
FOR b = 0 TO bins - 1 DO
$prof[b] = 0
NEXT
usedVolume = 0
FOR k = 0 TO n - 1 DO
w = 1
IF useVolume = 1 AND volume[k] > 0 THEN
w = volume[k]
usedVolume = 1
ENDIF
b0 = MAX(0, MIN(bins - 1, FLOOR((low[k] - bot) / stepSize)))
b1 = MAX(0, MIN(bins - 1, FLOOR((high[k] - bot) / stepSize)))
share = w / (b1 - b0 + 1)
FOR b = b0 TO b1 DO
$prof[b] = $prof[b] + share
NEXT
NEXT
// Point of control: the busiest row
total = ARRAYSUM($prof)
pocRow = 0
FOR b = 1 TO bins - 1 DO
IF $prof[b] > $prof[pocRow] THEN
pocRow = b
ENDIF
NEXT
maxRow = $prof[pocRow]
// Value area: grow from the POC towards the busier side until 70% is in
upRow = pocRow
dnRow = pocRow
inside = maxRow
WHILE inside < 0.7 * total AND (upRow < bins - 1 OR dnRow > 0) DO
nextUp = 0
nextDn = 0
IF upRow < bins - 1 THEN
nextUp = $prof[upRow + 1]
ENDIF
IF dnRow > 0 THEN
nextDn = $prof[dnRow - 1]
ENDIF
IF (nextUp >= nextDn AND upRow < bins - 1) OR dnRow = 0 THEN
upRow = upRow + 1
inside = inside + nextUp
ELSE
dnRow = dnRow - 1
inside = inside + nextDn
ENDIF
WEND
poc = bot + (pocRow + 0.5) * stepSize
vah = bot + (upRow + 1) * stepSize
val = bot + dnRow * stepSize
// The profile itself, drawn from the right, coloured by how busy each row
// is; the rows outside the value area stay fainter
xR = barindex + profRight
FOR b = 0 TO bins - 1 DO
len = ROUND($prof[b] / maxRow * profWidth)
IF len > 0 THEN
(cr, cg, cb) = heat($prof[b] / maxRow)
yLo = bot + b * stepSize + stepSize * 0.1
yHi = bot + (b + 1) * stepSize - stepSize * 0.1
IF b = pocRow THEN
DRAWRECTANGLE(xR - len, yLo, xR, yHi) FILLCOLOR(cr, cg, cb, 220) COLOURED(255, 235, 170)
ELSIF b >= dnRow AND b <= upRow THEN
DRAWRECTANGLE(xR - len, yLo, xR, yHi) FILLCOLOR(cr, cg, cb, 170) COLOURED(cr, cg, cb, 0)
ELSE
DRAWRECTANGLE(xR - len, yLo, xR, yHi) FILLCOLOR(cr, cg, cb, 70) COLOURED(cr, cg, cb, 0)
ENDIF
ENDIF
NEXT
// The value area across the profile's range, its edges and the POC
x0 = barindex - n + 1
DRAWRECTANGLE(x0, val, xR, vah) FILLCOLOR(70, 200, 210, 12) COLOURED(70, 200, 210, 0)
DRAWSEGMENT(x0, vah, xR, vah) COLOURED(70, 200, 210, 170) STYLE(dottedline, 1)
DRAWSEGMENT(x0, val, xR, val) COLOURED(70, 200, 210, 170) STYLE(dottedline, 1)
DRAWSEGMENT(x0, poc, xR, poc) COLOURED(245, 190, 70) STYLE(dashedline, 2)
pocTxt = ROUND(poc * 100) / 100
vahTxt = ROUND(vah * 100) / 100
valTxt = ROUND(val * 100) / 100
DRAWLABEL(xR, poc, "POC #pocTxt#", none, tiny, right) COLOURED(20, 22, 28) FILLCOLOR(245, 190, 70)
DRAWLABEL(xR, vah, "VAH #vahTxt#", none, tiny, right) COLOURED(70, 200, 210)
DRAWLABEL(xR, val, "VAL #valTxt#", none, tiny, right) COLOURED(70, 200, 210)
// The live order blocks, newest first, faded once tested
bulls = 0
bears = 0
bullConf = 0
bearConf = 0
FOR i = ARRAYSIZE($oDir) - 1 DOWNTO 0 DO
IF $oDir[i] = 1 AND bulls < maxBlocks THEN
bulls = bulls + 1
// Brighter and thicker when the VWAP confirms it, faded once tested
fillA = 30 + 35 * $oConf[i]
IF $oHit[i] = 1 THEN
fillA = fillA / 2
ENDIF
DRAWRECTANGLE($oBar[i], $oBot[i], barindex + 1, $oTop[i]) FILLCOLOR(60, 200, 130, fillA) COLOURED(60, 200, 130, 90 + 80 * $oConf[i]) STYLE(line, 1 + $oConf[i])
IF $oConf[i] = 2 THEN
DRAWTEXT("Bull OB ★★ VWAP", $oBar[i] + 3, $oTop[i] + 0.25 * atr, SansSerif, Bold, 10) COLOURED(60, 200, 130)
ELSIF $oConf[i] = 1 THEN
DRAWTEXT("Bull OB ★ VWAP", $oBar[i] + 3, $oTop[i] + 0.25 * atr, SansSerif, Bold, 10) COLOURED(60, 200, 130)
ELSE
DRAWTEXT("Bull OB", $oBar[i] + 3, $oTop[i] + 0.25 * atr, SansSerif, Bold, 10) COLOURED(60, 200, 130, 150)
ENDIF
bullConf = bullConf + ($oConf[i] >= 1)
ELSIF $oDir[i] = -1 AND bears < maxBlocks THEN
bears = bears + 1
fillA = 30 + 35 * $oConf[i]
IF $oHit[i] = 1 THEN
fillA = fillA / 2
ENDIF
DRAWRECTANGLE($oBar[i], $oBot[i], barindex + 1, $oTop[i]) FILLCOLOR(235, 85, 100, fillA) COLOURED(235, 85, 100, 90 + 80 * $oConf[i]) STYLE(line, 1 + $oConf[i])
IF $oConf[i] = 2 THEN
DRAWTEXT("Bear OB ★★ VWAP", $oBar[i] + 3, $oBot[i] - 0.25 * atr, SansSerif, Bold, 10) COLOURED(235, 85, 100)
ELSIF $oConf[i] = 1 THEN
DRAWTEXT("Bear OB ★ VWAP", $oBar[i] + 3, $oBot[i] - 0.25 * atr, SansSerif, Bold, 10) COLOURED(235, 85, 100)
ELSE
DRAWTEXT("Bear OB", $oBar[i] + 3, $oBot[i] - 0.25 * atr, SansSerif, Bold, 10) COLOURED(235, 85, 100, 150)
ENDIF
bearConf = bearConf + ($oConf[i] >= 1)
ENDIF
NEXT
// The dashboard
board = DRAWTABLE(9, 2, topleft) FILLCOLOR(boardBg) BORDERCOLOR(boardEdge)
TABLEMERGE(board, 0, 0, 1, 2)
TABLECELL(board, 0, 0, "SMART MONEY PROFILE", bold, center, 16) COLOURED(240, 236, 255) FILLCOLOR(boardHead)
TABLECELL(board, 1, 0, "Price vs value", 14) COLOURED(170, 180, 195)
IF close > vah THEN
TABLECELL(board, 1, 1, "Above · premium", bold, 14, right) COLOURED(255, 255, 255)
TABLEBG(board, 1, 1, 175, 55, 65)
ELSIF close < val THEN
TABLECELL(board, 1, 1, "Below · discount", bold, 14, right) COLOURED(255, 255, 255)
TABLEBG(board, 1, 1, 40, 150, 95)
ELSE
TABLECELL(board, 1, 1, "Inside value", bold, 14, right) COLOURED(70, 200, 210)
ENDIF
TABLECELL(board, 2, 0, "POC", 14) COLOURED(170, 180, 195)
TABLECELL(board, 2, 1, "#pocTxt#", 14, right) COLOURED(245, 190, 70)
TABLECELL(board, 3, 0, "Value area", 14) COLOURED(170, 180, 195)
TABLECELL(board, 3, 1, "#valTxt# – #vahTxt#", 14, right) COLOURED(70, 200, 210)
TABLECELL(board, 4, 0, "Order blocks bull / bear", 14) COLOURED(170, 180, 195)
TABLECELL(board, 4, 1, "#bulls# / #bears#", 14, right) COLOURED(214, 222, 235)
TABLECELL(board, 5, 0, "Confirmed by VWAP", 14) COLOURED(170, 180, 195)
TABLECELL(board, 5, 1, "#bullConf# / #bearConf#", bold, 14, right) COLOURED(232, 160, 255)
vwapTxt = ROUND(vwap * 100) / 100
TABLECELL(board, 6, 0, "VWAP", 14) COLOURED(170, 180, 195)
IF close > vwap THEN
TABLECELL(board, 6, 1, "#vwapTxt# · price above", 14, right) COLOURED(232, 160, 255)
ELSE
TABLECELL(board, 6, 1, "#vwapTxt# · price below", 14, right) COLOURED(232, 160, 255)
ENDIF
TABLECELL(board, 7, 0, "Profile", 14) COLOURED(170, 180, 195)
IF usedVolume = 1 THEN
TABLECELL(board, 7, 1, "volume · #n# bars", 14, right) COLOURED(214, 222, 235)
ELSE
TABLECELL(board, 7, 1, "time at price · #n# bars", 14, right) COLOURED(214, 222, 235)
ENDIF
TABLECELL(board, 8, 0, "Killzone", 14) COLOURED(170, 180, 195)
IF hhmm >= lonFrom AND hhmm < lonTo THEN
TABLECELL(board, 8, 1, "London", bold, 14, right) COLOURED(120, 160, 255)
ELSIF hhmm >= nyFrom AND hhmm < nyTo THEN
TABLECELL(board, 8, 1, "New York", bold, 14, right) COLOURED(255, 170, 60)
ELSE
TABLECELL(board, 8, 1, "none", 14, right) COLOURED(120, 130, 150)
ENDIF
ENDIF
RETURN vwap COLOURED(232, 160, 255, lineAlpha) STYLE(line, 2) AS "VWAP", up1 COLOURED(232, 160, 255, bandAlpha) STYLE(dottedline, 1) AS "VWAP +1σ", dn1 COLOURED(232, 160, 255, bandAlpha) STYLE(dottedline, 1) AS "VWAP -1σ", up2 COLOURED(232, 160, 255, bandAlpha * 0.6) STYLE(dottedline, 1) AS "VWAP +2σ", dn2 COLOURED(232, 160, 255, bandAlpha * 0.6) STYLE(dottedline, 1) AS "VWAP -2σ"