本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
//@version=6
// © TheSimplifier7
// THE PROFILE MAP. Where the volume went, and where it was unusual for its hour.
// WHAT IT DRAWS
// THE BUBBLES. Each bar on the map is cut into price rows on a fixed grid: a round step near 0.025% of price, anchored to
// whole multiples of it, so a row never moves. A row is dense when the bar traded there at least the set number of times
// as densely as a bar at that time of day usually trades (its usual volume over its usual range, the middle of the last 20
// sessions, read before the bar). Dense rows next to each other are one bubble, at their volume weighted price, sized by
// their volume as a share of the bar's usual whole volume. Only the heaviest on the map are drawn, so a lighter bubble
// gives way when a heavier one joins. One colour: the size says how unusual, the colour takes no side.
// THE PROFILE. The volume on screen summed by price, on a panel at the right edge, with its point of control (POC) and its
// value area (VAH and VAL, around the busiest 70 in 100 of the volume).
// NAKED POCS. Each session's busiest price that price has not traded back through, run on to the right edge.
// HOW THE VOLUME IS READ. From the bars inside each bar (1 minute on charts of an hour and under): each inside bar's volume
// is spread evenly over the prices it traded. On a chart smaller than the map's clock (1 hour by default) each clock bar is
// one column of the map, so the map reads the same on 5, 15 and 30 minutes as on the hour.
// WHAT THE COUNT SAYS. Gold, the author's broker feed, dense prices formed from 1 Jul 2014 to 2 Nov 2026, 34,172 returns:
// when price left a dense price and came back, it held 52.8 times in 100; ordinary prices traded in the same hour held
// 52.5. A session's busiest price held 52.4 against 50.1. Checked once more on gold before June 2014, data the count had
// never read: 52.1 against 54.0. Busy prices are not levels. The map describes where the volume went. It does not say
// where price turns.
// Closed bars only. The map is redrawn when a bar closes. A description of the volume, never a call.
indicator("The Profile Map [TheSimplifier7]", shorttitle = "Profile Map", overlay = true, max_labels_count = 500, max_boxes_count = 200, max_lines_count = 60)
// ---- the palette
color C_IVORY = #F3EDE2
color C_NAVY = #0B1A2E
color C_RAISED = #11233C
color C_CLEAR = color.new(#0B1A2E, 100)
// ---- inputs
string G_MP = "The map"
int keepN = input.int(150, "Bars on the map", minval = 20, maxval = 400, group = G_MP)
int rows = input.int(70, "Price rows", minval = 20, maxval = 120, group = G_MP, tooltip = "The panel's rows. The map itself counts on a fixed grid: rows of a quarter of a hundredth of a per cent of the last close (1 point at 4,000), anchored to round prices so they never move.")
int maxB = input.int(15, "Bubbles: the heaviest on the map", minval = 3, maxval = 250, group = G_MP, tooltip = "Only the heaviest dense prices are drawn, so the chart stays clean; heavy is volume as a share of the bar's usual. They are chosen from the whole map: when a heavier one joins, the lightest drawn gives way, and the oldest leave as the map rolls on. A bubble is where the volume went, not a level. Raise it to see more.")
bool glOn = input.bool(true, "Glow on the heavier bubbles", group = G_MP)
int ptMax = input.int(40, "Largest bubble, in points", minval = 16, maxval = 120, group = G_MP)
int usualN = input.int(20, "Sessions in the usual weight", minval = 5, maxval = 60, group = G_MP, tooltip = "The usual volume of a bar at this time of day: the middle of the same slot over this many sessions, read before the bar.")
string ltfIn = input.timeframe("", "Inside bars (empty: automatic)", group = G_MP, tooltip = "Automatic: 1 minute on charts of an hour and under, 5 minutes to 4 hours, 1 hour to a day, 4 hours above.")
string G_PR = "The profile"
bool prOn = input.bool(true, "Profile at the right edge", group = G_PR)
int panW = input.int(36, "Panel width, in bars", minval = 10, maxval = 120, group = G_PR)
int panGap = input.int(2, "Panel starts this many bars past the last bar", minval = 1, maxval = 300, group = G_PR, tooltip = "Move it right when other scripts write words at the right edge.")
int tagDp = input.int(2, "Most decimals on the price tags", minval = 0, maxval = 6, group = G_PR, tooltip = "The tags print the grid row's middle with no more decimals than the grid knows: 4,044.5 at a 1 point step.")
bool nkOn = input.bool(true, "Naked POCs: each session's busiest price, while nobody has traded back through it", group = G_PR)
bool tgOn = input.bool(true, "Price tags at the right edge", group = G_PR, tooltip = "Off: nothing of this script stands past the last bar but the profile, so another script can own the right edge.")
string clkIn = input.timeframe("60", "The map's clock", group = G_MP, tooltip = "On a chart smaller than this clock the map is read on the clock's bars: each one is a column of the map, its bubbles in the middle of it, sized against the usual volume of that hour of day. The bars on the map are then clock bars. On a chart of this clock or larger, the chart's own bars.")
float dnsX = input.float(2.0, "Dense: times as dense as the usual bar", minval = 1.0, maxval = 10.0, step = 0.25, group = G_MP, tooltip = "Lower draws more bubbles, higher fewer. On gold in 2026, on the author's broker feed, 2.0 lit about 40 hours in 100, 2.5 about 20 and 3 about 9; feeds whose volume is flatter inside the hour light fewer.")
bool scrOn = input.bool(true, "The map is what is on screen", group = G_MP, tooltip = "On: the profile, its value area and the busiest prices read only the bars on screen, up to the bars on the map, so no line or panel row stands outside the candles and the price scale stays theirs; the bubbles always read the whole map. It redraws when you scroll or zoom. Off: the profile reads the whole map too.")
string mcIn = input.string("Automatic", "The map's colour", options = ["Automatic", "Custom"], inline = "mc", group = G_MP, tooltip = "Automatic: one violet for unusual volume, light on a dark chart and deep on a light one, read from the chart's background; the size and strength say how unusual, the colour takes no side. Custom: the colour beside it.")
color mcCus = input.color(#C084FC, "", inline = "mc", group = G_MP)
bool LIGHT = 0.299 * color.r(chart.bg_color) + 0.587 * color.g(chart.bg_color) + 0.114 * color.b(chart.bg_color) > 150
color C_MAP = mcIn == "Custom" ? mcCus : LIGHT ? #7E3FD0 : #C084FC
color C_INK = LIGHT ? C_NAVY : C_IVORY
color C_INKT = LIGHT ? C_IVORY : C_NAVY
color C_PAN = LIGHT ? color.new(C_NAVY, 95) : C_RAISED
// ---- the pieces
type Cut
int idx
int day
float base
float hi
float lo
array<float> mo
array<float> mh
array<float> ml
array<float> mc
array<float> mv
float br
int tfs = timeframe.in_seconds()
// on a chart smaller than the map's clock, the map is read on the clock's bars
int CKS = timeframe.in_seconds(clkIn)
bool ANC = CKS > tfs
string ltf = ltfIn != "" ? ltfIn : tfs < 60 ? timeframe.period : tfs <= 3600 ? "1" : tfs <= 14400 ? "5" : tfs <= 86400 ? "60" : "240"
[io, ih, il, ic, iv] = request.security_lower_tf(syminfo.tickerid, ltf, [open, high, low, close, volume])
// the usual weight: a slot for each bar's time of day, the last usualN sessions of each slot
int tfm = int(math.max(1, (ANC ? CKS : tfs) / 60))
int slots = int(math.max(1, 1440 / tfm))
var matrix<float> usual = matrix.new<float>(slots, usualN, na)
var array<int> seen = array.new<int>(slots, 0)
// the usual range of a bar at this time of day, beside its usual volume
var matrix<float> usualR = matrix.new<float>(slots, usualN, na)
int tod = hour(time, "America/New_York") * 60 + minute(time, "America/New_York")
int slot = int(math.min(slots - 1, tod / tfm))
var array<Cut> cuts = array.new<Cut>()
var array<label> bubs = array.new<label>()
var array<box> pboxes = array.new<box>()
var array<line> plines = array.new<line>()
var int drawnIdx = na
// the grid's step, a quarter of a hundredth of a per cent of the price, the nearest round step (in ratio)
f_step(float px) =>
float raw = math.max(px * 0.00025, 1e-9)
array<float> nice = array.from(0.01, 0.02, 0.025, 0.05, 0.1, 0.2, 0.25, 0.5, 1.0, 2.0, 2.5, 5.0, 10.0, 20.0, 25.0, 50.0, 100.0)
float best = nice.get(0)
float bd = 1e9
for v in nice
float d = math.abs(math.log(v / raw))
if d < bd
bd := d
best := v
best
// the decimals a number needs, at most 6
f_dec(float x) =>
int d = 0
while d < 6 and math.abs(x * math.pow(10, d) - math.round(x * math.pow(10, d))) > 1e-7
d += 1
d
// a price format with d decimals
f_fmt(int d) =>
d > 0 ? "#,##0." + str.repeat("0", d) : "#,##0"
f_argmax(array<float> x) =>
int p = 0
float m = -1.0
for r = 0 to x.size() - 1
if x.get(r) > m
m := x.get(r)
p := r
p
// the clock bar being put together from the chart's closed bars: where it starts, its day, its range, its volume
// and its inside bars
bool ckNew = timeframe.change(clkIn)
var int aIdx = na
var int aT = na
var int aDay = na
var float aHi = na
var float aLo = na
var float aV = 0.0
var array<float> aO = array.new<float>()
var array<float> aH = array.new<float>()
var array<float> aL = array.new<float>()
var array<float> aC = array.new<float>()
var array<float> aW = array.new<float>()
if barstate.isconfirmed and not ANC
// the usual weight for this slot, read before this bar joins it
int n0 = seen.get(slot)
float base = na
float baseR = na
if n0 >= math.min(10, usualN)
array<float> rw = usual.row(slot)
base := array.median(rw.slice(0, math.min(n0, usualN)))
array<float> rwR = usualR.row(slot)
baseR := array.median(rwR.slice(0, math.min(n0, usualN)))
usual.set(slot, n0 % usualN, nz(volume))
usualR.set(slot, n0 % usualN, high - low)
seen.set(slot, n0 + 1)
if io.size() > 0
cuts.push(Cut.new(bar_index, time("D"), base, high, low, io, ih, il, ic, iv, baseR))
while cuts.size() > keepN
cuts.shift()
// anchored. At the first closed chart bar of a new clock bar the one before is whole: its usual weight is read
// for its hour of day before it joins it, and it goes on the map as one column, its bubbles in the middle of it
if barstate.isconfirmed and ANC
if ckNew and not na(aIdx)
int tdA = hour(aT, "America/New_York") * 60 + minute(aT, "America/New_York")
int slA = int(math.min(slots - 1, tdA / tfm))
int nA = seen.get(slA)
float baseA = na
float baseAR = na
if nA >= math.min(10, usualN)
array<float> rwA = usual.row(slA)
baseA := array.median(rwA.slice(0, math.min(nA, usualN)))
array<float> rwAR = usualR.row(slA)
baseAR := array.median(rwAR.slice(0, math.min(nA, usualN)))
usual.set(slA, nA % usualN, aV)
usualR.set(slA, nA % usualN, aHi - aLo)
seen.set(slA, nA + 1)
if aW.size() > 0
cuts.push(Cut.new(int(math.round((aIdx + bar_index - 1) / 2.0)), aDay, baseA, aHi, aLo, aO.copy(), aH.copy(), aL.copy(), aC.copy(), aW.copy(), baseAR))
while cuts.size() > keepN
cuts.shift()
aIdx := na
if na(aIdx)
aIdx := bar_index
aT := time
aDay := time("D")
aHi := high
aLo := low
aV := 0.0
aO.clear()
aH.clear()
aL.clear()
aC.clear()
aW.clear()
aHi := math.max(aHi, high)
aLo := math.min(aLo, low)
aV += nz(volume)
aO.concat(io)
aH.concat(ih)
aL.concat(il)
aC.concat(ic)
aW.concat(iv)
// what is on screen. The first and last bars on screen, read again whenever the chart is scrolled or zoomed (the
// script runs again then); where the chart gives no screen (an alert's run), the whole map
int visL = chart.left_visible_bar_time
int visR = chart.right_visible_bar_time
var int lIdx = na
var int rIdx = na
if not na(visL) and na(lIdx) and time >= visL
lIdx := bar_index
if not na(visR) and time <= visR
rIdx := bar_index
// the run of the map's bars whose middle bar is on screen, from wA to wB
int wA = -1
int wB = -1
if barstate.islast and cuts.size() > 0
for i = 0 to cuts.size() - 1
Cut c1 = cuts.get(i)
if not scrOn or na(lIdx) or (c1.idx >= lIdx and (na(rIdx) or c1.idx <= rIdx))
if wA < 0
wA := i
wB := i
// ---- two facts for alerts, each of the bar that just joined the map (on a chart smaller than the map's clock, the clock
// bar that just closed): it carries a dense price, a bubble's; it traded back through a naked POC
bool alNode = false
bool alPoc = false
// ---- the map, redrawn when a bar closes
if barstate.islast and cuts.size() > 1 and wA >= 0 and (na(drawnIdx) or cuts.get(cuts.size() - 1).idx != drawnIdx)
drawnIdx := cuts.get(cuts.size() - 1).idx
for x in bubs
label.delete(x)
bubs.clear()
for x in pboxes
box.delete(x)
pboxes.clear()
for x in plines
line.delete(x)
plines.clear()
float hi = cuts.get(0).hi
float lo = cuts.get(0).lo
for c0 in cuts
hi := math.max(hi, c0.hi)
lo := math.min(lo, c0.lo)
// the screen's own extremes, for the profile and the busiest prices
float hiW = cuts.get(wA).hi
float loW = cuts.get(wA).lo
for i = wA to wB
hiW := math.max(hiW, cuts.get(i).hi)
loW := math.min(loW, cuts.get(i).lo)
// the fixed grid. Rows of a round step anchored to whole multiples of it, so a row never moves as the map rolls
float rowH = f_step(close)
while math.floor(hi / rowH) - math.floor(lo / rowH) + 1 > 1500
rowH := rowH * 2
lo := math.floor(lo / rowH + 1e-9) * rowH
int nR = int(math.floor(hi / rowH + 1e-9) - math.floor(lo / rowH + 1e-9)) + 1
hi := lo + nR * rowH
int tagD = int(math.min(tagDp, f_dec(rowH / 2)))
// the screen's rows on the map's grid
int rW0 = int(math.max(0, math.floor((loW - lo) / rowH + 1e-9)))
int rW1 = int(math.max(rW0, math.min(nR - 1, math.floor((hiW - lo) / rowH + 1e-9))))
int nRW = rW1 - rW0 + 1
if rowH > 0 and nR > 1
array<float> totB = array.new<float>(nR, 0.0)
array<float> totS = array.new<float>(nR, 0.0)
array<float> cb = array.new<float>(nR, 0.0)
array<float> cs = array.new<float>(nR, 0.0)
array<float> dayT = array.new<float>(nR, 0.0)
array<float> pkP = array.new<float>()
array<int> pkI = array.new<int>()
// the nodes, dense rows next to each other in one bar: where, at what price, their volume as a share of the
// bar's usual
array<int> nX = array.new<int>()
array<float> nP = array.new<float>()
array<float> nS = array.new<float>()
int curDay = cuts.get(wA).day
for i = 0 to cuts.size() - 1
Cut b = cuts.get(i)
// every bar of the map feeds the bubbles; only the bars on screen feed the profile and the sessions
bool inW = i >= wA and i <= wB
if inW and b.day != curDay
pkP.push(lo + (f_argmax(dayT) + 0.5) * rowH)
pkI.push(i - 1)
dayT.fill(0.0)
curDay := b.day
int rmin = nR
int rmax = -1
for k = 0 to b.mv.size() - 1
float v = b.mv.get(k)
int ra = int(math.max(0, math.floor((b.ml.get(k) - lo) / rowH)))
int rz = int(math.min(nR - 1, math.floor((b.mh.get(k) - lo) / rowH)))
if rz >= ra and v > 0
float sh = v / (rz - ra + 1)
float wb = b.mc.get(k) > b.mo.get(k) ? 1.0 : b.mc.get(k) < b.mo.get(k) ? 0.0 : 0.5
for r = ra to rz
cb.set(r, cb.get(r) + sh * wb)
cs.set(r, cs.get(r) + sh * (1.0 - wb))
rmin := math.min(rmin, ra)
rmax := math.max(rmax, rz)
if rmax >= rmin
float nV = 0.0
float nY = 0.0
for r = rmin to rmax
float bb = cb.get(r)
float ss = cs.get(r)
if inW
totB.set(r, totB.get(r) + bb)
totS.set(r, totS.get(r) + ss)
dayT.set(r, dayT.get(r) + bb + ss)
// a dense row joins the node it is part of; the node ends at the first row that is not dense
bool dn_ = not na(b.base) and b.base > 0 and not na(b.br) and b.br > 0 and (bb + ss) / rowH / (b.base / b.br) >= dnsX
if dn_
nV += bb + ss
nY += (bb + ss) * (lo + (r + 0.5) * rowH)
if (not dn_ or r == rmax) and nV > 0
nX.push(b.idx)
nP.push(nY / nV)
nS.push(nV / b.base)
if i == cuts.size() - 1
alNode := true
nV := 0.0
nY := 0.0
cb.set(r, 0.0)
cs.set(r, 0.0)
// the nodes, light to heavy so the heaviest sit on top; the five heaviest carry an ivory core
int nN = nS.size()
if nN > 0
array<int> ordN = nS.sort_indices(order.ascending)
int glowsN = 0
for j = math.max(0, nN - maxB) to nN - 1
int q = ordN.get(j)
float sN = nS.get(q)
int ptN = int(math.round(9 + (ptMax - 9) * math.pow(math.min(1.0, sN / 1.2), 0.6)))
string tipN = "Dense for its bar at " + str.tostring(nP.get(q), f_fmt(tagD)) + ": it traded " + str.tostring(sN, "0.00") + " of the bar's usual whole volume, at least " + str.tostring(dnsX, "0.00") + " times as densely as that bar usually trades. The size says how unusual; the colour takes no side. Not a level: on gold since 2014, price came back to such prices and held no more often than at ordinary ones (52.8 against 52.5 in 100). A fact of the closed bars, never a call."
// the bigger the stronger, and see-through, so the candles show
float aN = 0.30 + 0.25 * math.min(1.0, sN / 1.2)
int trN = int(math.round(100 - 100 * aN))
if glOn and sN >= 0.35 and glowsN < 60
bubs.push(label.new(nX.get(q), nP.get(q), "●", style = label.style_none, textcolor = color.new(C_MAP, 94), size = int(math.round(ptN * 1.6)), textalign = text.align_center))
bubs.push(label.new(nX.get(q), nP.get(q), "●", style = label.style_none, textcolor = color.new(C_MAP, 86), size = int(math.round(ptN * 1.25)), textalign = text.align_center))
glowsN += 1
bubs.push(label.new(nX.get(q), nP.get(q), "●", style = label.style_none, textcolor = color.new(C_MAP, trN), size = ptN, textalign = text.align_center, tooltip = tipN))
// the exact core, at the node's volume weighted price
bubs.push(label.new(nX.get(q), nP.get(q), "●", style = label.style_none, textcolor = color.new(C_INK, 35), size = 5, textalign = text.align_center, tooltip = tipN))
for j = nN - 1 to math.max(0, nN - 5)
int q = ordN.get(j)
bubs.push(label.new(nX.get(q), nP.get(q), "●", style = label.style_none, textcolor = C_INK, size = 8, textalign = text.align_center, tooltip = "One of the five heaviest dense prices on the map."))
// the profile on its panel, the busiest prices
int xL = bar_index + panGap
int xR = bar_index + panGap + panW
array<float> tot = array.new<float>(nR, 0.0)
for r = 0 to nR - 1
tot.set(r, totB.get(r) + totS.get(r))
float maxT = tot.max()
if maxT > 0
int P = f_argmax(tot)
int vl = P
int vh = P
float acc = tot.get(P)
float tsum = tot.sum()
while acc < 0.70 * tsum
float up_ = vh + 1 <= rW1 ? tot.get(vh + 1) : -1.0
float dn_ = vl - 1 >= rW0 ? tot.get(vl - 1) : -1.0
if up_ >= dn_
vh += 1
acc += up_
else
vl -= 1
acc += dn_
float pocY = lo + (P + 0.5) * rowH
plines.push(line.new(cuts.get(wA).idx, pocY, prOn ? xL : cuts.get(wB).idx, pocY, color = color.new(C_INK, 70), width = 1))
if prOn
pboxes.push(box.new(xL, lo + (rW1 + 2) * rowH, xR, lo + (rW0 - 1) * rowH, border_color = C_CLEAR, border_width = 0, bgcolor = C_PAN))
// the panel draws "Price rows" rows, each the sum of the grid's rows inside it
int g = int(math.max(1, math.ceil(nRW / float(rows))))
int nD = int(math.ceil(nRW / float(g)))
array<float> dT = array.new<float>(nD, 0.0)
for r = rW0 to rW1
int d = int(math.floor((r - rW0) / g))
dT.set(d, dT.get(d) + tot.get(r))
float maxD = dT.max()
int dP = int(math.floor((P - rW0) / g))
for d = 0 to nD - 1
float t = dT.get(d)
int len = int(math.round(t / maxD * (panW - 2)))
if len >= 1
float yb = lo + (rW0 + d * g) * rowH
float yt = lo + (rW0 + math.min(nRW, (d + 1) * g)) * rowH
bool inva = rW0 + (d + 1) * g - 1 >= vl and rW0 + d * g <= vh
float al = d == dP ? 0.95 : inva ? 0.50 : 0.16
color col = d == dP ? C_INK : C_MAP
pboxes.push(box.new(xR - 1 - len, yt - 0.14 * (yt - yb), xR - 1, yb + 0.14 * (yt - yb), border_color = C_CLEAR, border_width = 0, bgcolor = color.new(col, int(math.round(100 - 100 * al)))))
plines.push(line.new(xL, lo + vl * rowH, xR, lo + vl * rowH, color = color.new(C_INK, 60), width = 1))
plines.push(line.new(xL, lo + (vh + 1) * rowH, xR, lo + (vh + 1) * rowH, color = color.new(C_INK, 60), width = 1))
// the panel's three prices named, in the words every volume trader uses, past the panel's right end
if tgOn
float vahY = lo + (vh + 1) * rowH
float valY = lo + vl * rowH
bubs.push(label.new(xR, vahY, "VAH " + str.tostring(vahY, f_fmt(tagD)), style = label.style_label_lower_left, color = color(na), textcolor = color.new(C_INK, 25), size = size.tiny, tooltip = "Value area high: the top of the busiest 70 in 100 of the volume on screen."))
bubs.push(label.new(xR, pocY, "POC " + str.tostring(pocY, f_fmt(tagD)), style = label.style_label_left, color = C_INK, textcolor = C_INKT, size = size.tiny, tooltip = "Point of control: the busiest price on screen, the ivory row and the hairline across the chart."))
bubs.push(label.new(xR, valY, "VAL " + str.tostring(valY, f_fmt(tagD)), style = label.style_label_upper_left, color = color(na), textcolor = color.new(C_INK, 25), size = size.tiny, tooltip = "Value area low: the bottom of the busiest 70 in 100 of the volume on screen."))
if nkOn and pkP.size() > 0
for d = 0 to pkP.size() - 1
float pp = pkP.get(d)
int iEnd = pkI.get(d)
bool touched = false
for i = iEnd + 1 to cuts.size() - 1
Cut b = cuts.get(i)
if b.lo <= pp and b.hi >= pp
touched := true
if i == cuts.size() - 1
alPoc := true
break
if not touched and iEnd + 1 <= cuts.size() - 1
plines.push(line.new(cuts.get(iEnd).idx, pp, prOn ? xL : tgOn ? bar_index + 1 : cuts.get(cuts.size() - 1).idx, pp, color = color.new(C_INK, 15), style = line.style_dotted, width = 1))
if tgOn
bubs.push(label.new(prOn ? xL : bar_index + 1, pp, "naked POC " + str.tostring(pp, f_fmt(tagD)), style = label.style_label_left, color = C_INK, textcolor = C_INKT, size = size.small, tooltip = "A naked POC: a session's busiest price (its point of control), on a grid of " + str.tostring(rowH) + ", that nobody has traded back through since. Not a level: on gold since 2014, price came back to a session's busiest price and held 52.4 times in 100, against 50.1 at ordinary prices."))
// ---- a quiet notice when the map has nothing to draw, so a blank chart says why
var float volSum = 0.0
volSum += nz(volume)
var table note = table.new(position.bottom_right, 1, 1)
if barstate.islast
int usable = 0
for c9 in cuts
if not na(c9.base) and c9.base > 0
usable += 1
string msg = volSum == 0 ? "The Profile Map: this feed carries no volume, so the map has nothing to read." : cuts.size() == 0 ? "The Profile Map: no inside bars reached this chart. Try a larger chart timeframe." : usable == 0 ? "The Profile Map: the bubbles need about 10 sessions of history for each time of day, and this chart has loaded fewer. Try a larger chart timeframe." : ""
if msg != ""
table.cell(note, 0, 0, msg, text_color = LIGHT ? #4A5568 : #A8B3C4, text_size = size.small, bgcolor = color(na))
else
table.clear(note, 0, 0)
// ---- alerts, each a fact of the bar that just joined the map
alertcondition(alNode, "Unusual volume at a price", "THE PROFILE MAP on {{ticker}} {{interval}}: the bar that just joined the map traded unusual volume at one price")
alertcondition(alPoc, "A naked POC was traded through", "THE PROFILE MAP on {{ticker}} {{interval}}: price traded back through a session's busiest price that had stood untouched")