Nicolas

Bracket Footprint: 30-minute order-flow columns with auction tails and value migration

Studio Only
Category: Indicators By: Nicolas Created: December 4, 2026, 2:03 PM
December 4, 2026, 2:03 PM
Indicators
0 Comments
ProRealCode Script
Bracket Footprint: 30-minute order-flow columns with auction tails and value migration

Bracket Footprint cuts each trading session into brackets, 30 minutes by default, and draws every bracket as a column of price rows on the price chart. Each cell shows the estimated sellers x buyers traded at that price during that bracket, and is tinted by the dominant side, more strongly as the row traded more. Behind the columns, a halo shows the heat of each price row, softened over two rows on each side and fading from one bracket to the next. Bubbles mark the candles whose volume is at least 2.5 times the 50-candle average, in five sizes, coloured by the dominant side.

On top of the map comes the auction reading: the POC and the value area of each session, the previous session’s value area carried into the current one, buying and selling tails, one-time framing, and three signals with their alerts. One indicator, two places: the map is drawn on the price chart, and the indicator’s own panel below holds the session’s running delta and a small table that sums up the state of the auction and lists the latest signals.

This code is written in ProRealCode Script and runs with ProRealCode Studio on ProRealTime Web. It only runs there: it cannot be imported into the ProRealTime platform as an .itf file.

Bracket Footprint on a Mini DAX future 5-minute dark chart, Blue and Red colours: 30-minute columns of sellers x buyers cells over a halo, volume bubbles, POC and value area lines, auction tail labels and the session delta panel with its table

Mini DAX future, 5-minute chart, live, dark chart with the “Blue and Red” colours: blue cells where buyers dominated, red where sellers did. Look at the “Buying tail” labels under the session lows, the bubbles on the heaviest candles, and the delta panel with its table below.

Bracket Footprint on a Mini DAX future 5-minute light chart, Green and Red colours with Chart background set to Light: bracket columns, halo, value area lines and the session delta panel

The same instrument and timeframe on a light chart, with the “Green and Red” colours and “Chart background” set to “Light”, so the numbers and the lines keep their contrast.

How to read it

The columns. Each column is one bracket. Each cell reads sellers x buyers: the estimated volume on each side at that price row during that bracket. The cell takes the colour of the side that dominated, and its colour is stronger as the row traded more.

The halo. The glow behind the columns is the heat of each price row, softened over two rows on each side. Each row keeps part of its heat into the next bracket (“Halo memory”, half by default), so prices that keep trading stay lit while the ones the market left behind fade out.

The bubbles. A bubble marks a candle whose volume is at least 2.5 times the average volume of the last 50 candles. It comes in five sizes, larger as the candle is heavier, and is coloured by the dominant side of that candle.

POC and value area. For each session, the solid line is the POC, the price row that traded the most. The two dotted lines are the VAH and the VAL: they hold 70% of the session volume by default, grown from the POC towards the heavier neighbouring row. The previous session’s value area is carried into the current session as two dimmer dotted lines.

Tails. A “Buying tail” or “Selling tail” label marks rows at the session extreme that were traded by a single bracket and not revisited by the next one, 2 rows at least by default.

One-time framing. Brackets in a row that each hold the previous bracket’s low say that buyers are in control; brackets in a row that each hold the previous bracket’s high say that sellers are. The run counts from 3 brackets by default.

The three signals

A bracket is judged once it is complete, so a signal sits on the first candle of the next bracket, the moment it became known. Each signal is marked by an arrow on the candle, a short label (“Tail”, “Value” or “OTF ends”) and an arrow on the delta curve.

  • Tail: a buying or selling tail is confirmed.
  • Value (value re-entry): the session opens outside the previous session’s value area, then two brackets in a row close back inside it. The signal points to the other side of that area.
  • OTF ends: a one-time framing run of at least 3 brackets is broken.

There is one signal per bracket at most: a tail wins over a value re-entry, which wins over the end of one-time framing.

Alerts. Each signal fires an alert() once on its candle, with a JSON payload {signal, side, price} that an automation can read. Alerts only fire in real time, never on history.

The delta panel and its table

The panel shows the session delta: estimated buyers minus estimated sellers, cumulated candle by candle and reset at each new session. It is in notional by default (volume x price x point value, in millions), or in volume, and it is filled with the colour of its sign.

The table at the top of the panel holds:

  • Value against the previous session: higher, overlapping higher, inside, outside, overlapping lower or lower.
  • Control: buyers, sellers or two-sided, from the current one-time framing run.
  • A journal of the latest signals: the time, the signal and its side, the price, and Since (%), the move since the signal counted in its own direction. A greyed time means the signal belongs to an earlier session.

Settings

Paste the code into a new Studio tab and run it. The map appears on the price chart and the delta panel opens below it. The settings, with their defaults:

  • Bracket length (minutes) (30): length of one column. The chart must be finer than this.
  • Row height (0): price height of one row. 0 is automatic: about 30 rows over the range, snapped to 1, 2 or 5.
  • Sessions (2): sessions rebuilt, the current one included. Two are needed to compare value areas.
  • Brackets drawn (26): columns drawn, counted from the latest one.
  • Show sellers x buyers (on): writes the two estimated volumes in each cell. Zoom in if they overlap.
  • Halo (on): the glow behind the columns.
  • Halo memory (0.5): share of its heat a row keeps into the next bracket.
  • Bubbles: volume above x times the average (2.5): 0 hides the bubbles.
  • Value area (percent) (70): share of the session volume held between VAL and VAH.
  • Tail (rows) (2): rows traded by a single bracket at the session extreme needed to call a tail.
  • One-time framing (brackets) (3): brackets in a row needed before one side is said to be in control.
  • Journal rows (4): latest signals listed in the table. 0 hides the journal.
  • Delta in notional (on): on, volume x price x point value in millions; off, volume.
  • Colours (“Blue and Red”): Blue and Red, Green and Red, or Teal and Orange. The first colour is for buyers, the second for sellers.
  • Chart background (“Dark”): Dark or Light. Match it to your chart so the numbers and the lines keep their contrast.

Limits

  • Buyers and sellers are estimated from where each candle closes in its range: a close on the high counts as all buyers, a close on the low as all sellers. They are not counted from trades at the bid and the ask.
  • The estimate gets finer as the chart timeframe gets smaller, so use a chart clearly finer than the bracket: 1 or 2 minutes for 30-minute brackets. The screenshots above use 5 minutes.
  • An instrument without volume gives an empty map.
  • The halo and the bubbles come from the same candle volume. They are not order-book data or options data.
  • The whole window is rebuilt on every tick: keep “Sessions” low on 24-hour markets.
  • The three rules are classic auction-market readings, shown as a visual aid. They have not been backtested and no performance is claimed: test them on your own instruments and timeframes before relying on them.

Under the hood

The code uses these ProRealCode Script additions:

  • input() with group, tooltip, options, minval, maxval and step, for the fifteen settings.
  • String variables and string comparison, for the colours and the chart background.
  • ONPRICE, to draw the map, the lines, the labels and the arrows on the price chart from an indicator that lives in its own panel.
  • DRAWTABLE, TABLECELL and TABLEMERGE, for the table in the delta panel.
  • alert() with a JSON payload, for the three signals.

See also

Two indicators of the same family: Footprint Clusters and Volume Heatmap & Bubbles.

//----------------------------------------------------------------
// PRC_Bracket Footprint | indicator
// Author: Nicolas
// Date: 04.12.2026
// https://www.prorealcode.com
// License: CC BY-NC 4.0 - free to use, share and modify for
// non-commercial purposes, provided the author and the source
// above are credited.
// https://creativecommons.org/licenses/by-nc/4.0/
//----------------------------------------------------------------
// The session cut into brackets (30 minutes by default). Each
// bracket is a column of price rows showing sellers x buyers,
// tinted by the side that dominated, over a halo: the heat of
// each price row, fading from one bracket to the next. Bubbles
// mark the candles much heavier than the average.
// On top of it, the auction reading: value area and POC of each
// session, buying and selling tails, one-time framing, and where
// today's value sits against yesterday's.
// Below, the running delta of the session.
// Buyers and sellers are ESTIMATED from where each candle closes
// in its range: use a fine chart, 1 or 2 minutes.
// Runs with ProRealCode Studio: https://www.prorealcode.com/prorealcode-studio/
//----------------------------------------------------------------
DEFPARAM overlay = false
DEFPARAM drawonlastbaronly = true

// ---------- Settings
input(bracketMin, 30, "Bracket length (minutes)", int, minval = 5, maxval = 240, group = "Map", tooltip = "Length of one column. The chart must be finer than this")
input(rowHeight, 0, "Row height", float, minval = 0, group = "Map", tooltip = "Price height of one row. 0 picks a round value from the range on screen")
input(sessionsBack, 2, "Sessions", int, minval = 1, maxval = 5, group = "Map", tooltip = "Sessions rebuilt, the current one included. Two are needed to compare value areas")
input(bracketsShown, 26, "Brackets drawn", int, minval = 1, maxval = 96, group = "Map", tooltip = "Columns drawn, counted from the latest one")
input(showNumbers, 1, "Show sellers x buyers", bool, group = "Map", tooltip = "Writes the two estimated volumes in each cell. Zoom in if they overlap")
input(showHalo, 1, "Halo", bool, group = "Map", tooltip = "Glow behind the columns: the heat of each price row, softened over its neighbours and fading from one bracket to the next")
input(haloMemory, 0.5, "Halo memory", float, minval = 0, maxval = 0.9, step = 0.1, group = "Map", tooltip = "Share of its heat a row keeps into the next bracket")
input(bubbleMult, 2.5, "Bubbles: volume above x times the average", float, minval = 0, maxval = 10, step = 0.5, group = "Map", tooltip = "A candle this many times heavier than the average of the last 50 gets a bubble, larger as it gets heavier. 0 hides them")
input(valuePct, 70, "Value area (percent)", int, minval = 50, maxval = 95, group = "Auction", tooltip = "Share of the session volume held between VAL and VAH")
input(tailRows, 2, "Tail (rows)", int, minval = 1, maxval = 10, group = "Auction", tooltip = "Rows traded by a single bracket at the session extreme needed to call a tail")
input(otfMin, 3, "One-time framing (brackets)", int, minval = 2, maxval = 10, group = "Auction", tooltip = "Brackets in a row holding the previous low, or the previous high, before one side is said to be in control")
input(journalRows, 4, "Journal rows", int, minval = 0, maxval = 8, group = "Signals", tooltip = "Latest signals listed in the panel. 0 hides the journal")
input(useNotional, 1, "Delta in notional", bool, group = "Delta panel", tooltip = "On: volume x price x point value, in millions. Off: volume")
input(palette, "Blue and Red", "Colours", string, options = ["Blue and Red", "Green and Red", "Teal and Orange"], group = "Appearance", tooltip = "First colour for buyers, second colour for sellers")
input(chartBg, "Dark", "Chart background", string, options = ["Dark", "Light"], group = "Appearance", tooltip = "Match it to the chart so the numbers and the lines keep their contrast")

// ---------- Colours
IF chartBg = "Light" THEN
    inkR = 40
    inkG = 46
    inkB = 56
    dimR = 120
    dimG = 128
    dimB = 140
    cardR = 244
    cardG = 245
    cardB = 247
    lineR = 208
    lineG = 212
    lineB = 218
ELSE
    inkR = 232
    inkG = 235
    inkB = 240
    dimR = 150
    dimG = 158
    dimB = 170
    cardR = 30
    cardG = 34
    cardB = 42
    lineR = 62
    lineG = 68
    lineB = 80
ENDIF
IF palette = "Green and Red" THEN
    buyR = 0
    buyG = 175
    buyB = 115
    sellR = 235
    sellG = 60
    sellB = 70
ELSIF palette = "Teal and Orange" THEN
    buyR = 0
    buyG = 190
    buyB = 180
    sellR = 255
    sellG = 140
    sellB = 30
ELSE
    buyR = 40
    buyG = 130
    buyB = 255
    sellR = 240
    sellG = 70
    sellB = 70
ENDIF

// ---------- Estimated order flow, candle by candle
// a candle closing on its high is read as all buyers, on its
// low as all sellers, in the middle as half and half
buyShare = 0.5
IF high > low THEN
    buyShare = (close - low) / (high - low)
ENDIF
barDelta = volume * (2 * buyShare - 1)
IF useNotional THEN
    barDelta = barDelta * close * PointValue / 1000000
ENDIF
avgVol = Average[50](volume)
// the first candle of a session, and the bracket each candle falls in
newDay = IntradayBarIndex = 0
slot = FLOOR((OpenHour * 60 + OpenMinute) / bracketMin)
IF newDay THEN
    sessDelta = barDelta
ELSE
    sessDelta = sessDelta + barDelta
ENDIF

IF journalRows > 0 THEN
    tb = DRAWTABLE(journalRows + 3, 4, topleft) FILLCOLOR(cardR, cardG, cardB, 235) BORDERCOLOR(lineR, lineG, lineB) COLOURED(inkR, inkG, inkB)
ENDIF

// ---------- The map: rebuilt from the candles on the latest bar
// note: the whole window is walked again on every tick, about
// 12 ms for two 24-hour sessions in 1-minute candles; keep the
// progress in arrays if more sessions are needed
IF IsLastBarUpdate THEN
    // 1. how far back, and the price range covered
    lookBack = 0
    seen = 0
    hiAll = high
    loAll = low
    FOR i = 0 TO MIN(barindex, 6000) DO
        lookBack = i
        hiAll = MAX(hiAll, high[i])
        loAll = MIN(loAll, low[i])
        IF newDay[i] THEN
            seen = seen + 1
            IF seen >= sessionsBack THEN
                BREAK
            ENDIF
        ENDIF
    NEXT

    IF hiAll > loAll THEN
        // 2. the price grid
        rowSize = rowHeight
        IF rowSize <= 0 THEN
            // about 30 rows over the range, snapped to 1, 2 or 5
            rawSize = (hiAll - loAll) / 30
            pw = EXP(LOG(10) * FLOOR(LOG(rawSize) / LOG(10)))
            mant = rawSize / pw
            IF mant < 1.5 THEN
                rowSize = pw
            ELSIF mant < 3.5 THEN
                rowSize = 2 * pw
            ELSIF mant < 7.5 THEN
                rowSize = 5 * pw
            ELSE
                rowSize = 10 * pw
            ENDIF
        ENDIF
        rowSize = MAX(rowSize, (hiAll - loAll) / 300)
        baseRow = FLOOR(loAll / rowSize)
        nRows = FLOOR(hiAll / rowSize) - baseRow + 1

        // 3. the candles, oldest first, poured into brackets and rows
        ARRAYCLEAR($buy)
        ARRAYCLEAR($sell)
        ARRAYCLEAR($prof)
        ARRAYCLEAR($sFirst)
        ARRAYCLEAR($cX1)
        ARRAYCLEAR($cX2)
        ARRAYCLEAR($cSess)
        ARRAYCLEAR($cOpen)
        ARRAYCLEAR($cHi)
        ARRAYCLEAR($cLo)
        ARRAYCLEAR($cClose)
        col = -1
        ses = -1
        prevSlot = -1
        maxCell = 0
        FOR i = lookBack DOWNTO 0 DO
            newSes = 0
            IF i = lookBack OR newDay[i] THEN
                newSes = 1
                ses = ses + 1
                $sFirst[ses] = col + 1
            ENDIF
            IF newSes OR slot[i] <> prevSlot THEN
                col = col + 1
                $cX1[col] = barindex - i
                $cSess[col] = ses
                $cOpen[col] = open[i]
                $cHi[col] = high[i]
                $cLo[col] = low[i]
            ENDIF
            prevSlot = slot[i]
            $cX2[col] = barindex - i
            $cHi[col] = MAX($cHi[col], high[i])
            $cLo[col] = MIN($cLo[col], low[i])
            $cClose[col] = close[i]
            // the volume of the candle is spread evenly over its rows
            rowLo = FLOOR(low[i] / rowSize) - baseRow
            rowHi = FLOOR(high[i] / rowSize) - baseRow
            piece = volume[i] / (rowHi - rowLo + 1)
            FOR r = rowLo TO rowHi DO
                cell = col * nRows + r
                $buy[cell] = $buy[cell] + piece * buyShare[i]
                $sell[cell] = $sell[cell] + piece * (1 - buyShare[i])
                $prof[ses * nRows + r] = $prof[ses * nRows + r] + piece
                maxCell = MAX(maxCell, $buy[cell] + $sell[cell])
            NEXT
        NEXT
        nCols = col + 1
        nSes = ses + 1
        firstShown = MAX(0, nCols - bracketsShown)
        xShown = $cX1[firstShown]

        // 4. POC and value area of each session
        ARRAYCLEAR($sPoc)
        ARRAYCLEAR($sVah)
        ARRAYCLEAR($sVal)
        FOR q = 0 TO nSes - 1 DO
            total = 0
            top = 0
            pocRow = 0
            FOR r = 0 TO nRows - 1 DO
                v = $prof[q * nRows + r]
                total = total + v
                IF v > top THEN
                    top = v
                    pocRow = r
                ENDIF
            NEXT
            // grow from the POC towards the heavier neighbour
            rUp = pocRow
            rDn = pocRow
            held = top
            WHILE held < total * valuePct / 100 AND (rUp < nRows - 1 OR rDn > 0) DO
                vUp = 0
                vDn = 0
                IF rUp < nRows - 1 THEN
                    vUp = $prof[q * nRows + rUp + 1]
                ENDIF
                IF rDn > 0 THEN
                    vDn = $prof[q * nRows + rDn - 1]
                ENDIF
                IF rDn = 0 OR (rUp < nRows - 1 AND vUp >= vDn) THEN
                    rUp = rUp + 1
                    held = held + vUp
                ELSE
                    rDn = rDn - 1
                    held = held + vDn
                ENDIF
            WEND
            $sPoc[q] = (baseRow + pocRow + 0.5) * rowSize
            $sVah[q] = (baseRow + rUp + 1) * rowSize
            $sVal[q] = (baseRow + rDn) * rowSize
        NEXT

        // 5. the halo: the heat of each row, softened over two rows on
        // each side, fading from one bracket to the next
        IF showHalo THEN
            FOR c = 0 TO nCols - 1 DO
                IF c = $sFirst[$cSess[c]] THEN
                    ARRAYCLEAR($hb)
                    ARRAYCLEAR($hs)
                ENDIF
                // rows are stored 4 cells up, so the softening can read below row 0
                FOR r = 0 TO nRows - 1 DO
                    $hb[r + 4] = $hb[r + 4] * haloMemory + $buy[c * nRows + r]
                    $hs[r + 4] = $hs[r + 4] * haloMemory + $sell[c * nRows + r]
                NEXT
                IF c >= firstShown THEN
                    xl = $cX1[c]
                    xr = $cX2[c] + 1
                    IF c < nCols - 1 THEN
                        xr = $cX1[c + 1]
                    ENDIF
                    FOR k = 2 TO nRows + 5 DO
                        hBuy = 0.4 * $hb[k] + 0.2 * ($hb[k - 1] + $hb[k + 1]) + 0.1 * ($hb[k - 2] + $hb[k + 2])
                        hSell = 0.4 * $hs[k] + 0.2 * ($hs[k - 1] + $hs[k + 1]) + 0.1 * ($hs[k - 2] + $hs[k + 2])
                        IF hBuy + hSell > 0.02 * maxCell THEN
                            yb = (baseRow + k - 4) * rowSize
                            glow = MIN(120, 140 * SQRT((hBuy + hSell) / maxCell))
                            IF hBuy >= hSell THEN
                                DRAWRECTANGLE(xl, yb, xr, yb + rowSize) COLOURED(buyR, buyG, buyB, 0) FILLCOLOR(buyR, buyG, buyB, glow) ONPRICE
                            ELSE
                                DRAWRECTANGLE(xl, yb, xr, yb + rowSize) COLOURED(sellR, sellG, sellB, 0) FILLCOLOR(sellR, sellG, sellB, glow) ONPRICE
                            ENDIF
                        ENDIF
                    NEXT
                ENDIF
            NEXT
        ENDIF

        // 6. the cells
        unit = 1
        IF maxCell >= 20000 THEN
            unit = 1000
        ENDIF
        FOR c = firstShown TO nCols - 1 DO
            xl = $cX1[c]
            xr = $cX2[c] + 1
            IF c < nCols - 1 THEN
                xr = $cX1[c + 1]
            ENDIF
            FOR r = FLOOR($cLo[c] / rowSize) - baseRow TO FLOOR($cHi[c] / rowSize) - baseRow DO
                cell = c * nRows + r
                bv = $buy[cell]
                sv = $sell[cell]
                IF bv + sv > 0 THEN
                    yb = (baseRow + r) * rowSize
                    glow = 25 + 190 * SQRT((bv + sv) / maxCell)
                    IF bv >= sv THEN
                        DRAWRECTANGLE(xl, yb, xr, yb + rowSize) COLOURED(cardR, cardG, cardB, 255) FILLCOLOR(buyR, buyG, buyB, glow) ONPRICE
                    ELSE
                        DRAWRECTANGLE(xl, yb, xr, yb + rowSize) COLOURED(cardR, cardG, cardB, 255) FILLCOLOR(sellR, sellG, sellB, glow) ONPRICE
                    ENDIF
                    IF showNumbers THEN
                        bn = ROUND(bv / unit)
                        sn = ROUND(sv / unit)
                        DRAWTEXT("#sn# x #bn#", (xl + xr) / 2, yb + rowSize / 2, SansSerif, Standard, 10) COLOURED(inkR, inkG, inkB) ONPRICE
                    ENDIF
                ENDIF
            NEXT
        NEXT

        // 7. the bubbles: candles much heavier than the average
        IF bubbleMult > 0 THEN
            FOR i = barindex - xShown DOWNTO 0 DO
                IF avgVol[i] > 0 AND volume[i] >= bubbleMult * avgVol[i] THEN
                    dotSize = 3 * MIN(5, 1 + FLOOR(2 * (volume[i] / (bubbleMult * avgVol[i]) - 1)))
                    IF buyShare[i] >= 0.5 THEN
                        DRAWPOINT(barindex - i, (high[i] + low[i]) / 2, dotSize) COLOURED(buyR, buyG, buyB, 150) BORDERCOLOR(inkR, inkG, inkB, 220) ONPRICE
                    ELSE
                        DRAWPOINT(barindex - i, (high[i] + low[i]) / 2, dotSize) COLOURED(sellR, sellG, sellB, 150) BORDERCOLOR(inkR, inkG, inkB, 220) ONPRICE
                    ENDIF
                ENDIF
            NEXT
        ENDIF

        // 8. POC and value area, session by session
        FOR q = 0 TO nSes - 1 DO
            xs = MAX(xShown, $cX1[$sFirst[q]])
            xe = barindex + 2
            IF q < nSes - 1 THEN
                xe = $cX1[$sFirst[q + 1]]
            ENDIF
            IF xe > xs THEN
                DRAWSEGMENT(xs, $sPoc[q], xe, $sPoc[q]) COLOURED(inkR, inkG, inkB) STYLE(line, 2) ONPRICE
                DRAWSEGMENT(xs, $sVah[q], xe, $sVah[q]) COLOURED(inkR, inkG, inkB) STYLE(dottedline, 1) ONPRICE
                DRAWSEGMENT(xs, $sVal[q], xe, $sVal[q]) COLOURED(inkR, inkG, inkB) STYLE(dottedline, 1) ONPRICE
                IF q > 0 THEN
                    // yesterday's value area carried into today
                    DRAWSEGMENT(xs, $sVah[q - 1], xe, $sVah[q - 1]) COLOURED(dimR, dimG, dimB) STYLE(dottedline2, 1) ONPRICE
                    DRAWSEGMENT(xs, $sVal[q - 1], xe, $sVal[q - 1]) COLOURED(dimR, dimG, dimB) STYLE(dottedline2, 1) ONPRICE
                ENDIF
            ENDIF
        NEXT

        // 9. the auction, bracket by bracket. A bracket is judged
        // once it is complete; the signal sits on the first candle
        // of the next one, the moment it became known
        ARRAYCLEAR($gX)
        ARRAYCLEAR($gSide)
        ARRAYCLEAR($gKind)
        nSig = 0
        runUp = 0
        runDn = 0
        FOR c = 0 TO nCols - 1 DO
            q = $cSess[c]
            IF c = $sFirst[q] THEN
                lowBefore = hiAll + rowSize
                highBefore = loAll - rowSize
                runUp = 0
                runDn = 0
                inValue = 0
                reEntered = 0
                openSide = 0
                IF q > 0 THEN
                    IF $cOpen[c] > $sVah[q - 1] THEN
                        openSide = 1
                    ELSIF $cOpen[c] < $sVal[q - 1] THEN
                        openSide = -1
                    ENDIF
                ENDIF
            ELSE
                complete = c < nCols - 1
                sigSide = 0
                sigKind = 0
                // one-time framing: each bracket holds the previous low (buyers in
                // control) or the previous high (sellers). The run ending is the signal
                IF $cLo[c] >= $cLo[c - 1] THEN
                    runUp = runUp + 1
                ELSE
                    IF runUp >= otfMin AND complete THEN
                        sigSide = -1
                        sigKind = 3
                    ENDIF
                    runUp = 0
                ENDIF
                IF $cHi[c] <= $cHi[c - 1] THEN
                    runDn = runDn + 1
                ELSE
                    IF runDn >= otfMin AND complete THEN
                        sigSide = 1
                        sigKind = 3
                    ENDIF
                    runDn = 0
                ENDIF
                IF complete THEN
                    // value re-entry: an open outside yesterday's value area, then two
                    // brackets closing back inside it, aims at the other side of it
                    IF q > 0 THEN
                        IF $cClose[c] <= $sVah[q - 1] AND $cClose[c] >= $sVal[q - 1] THEN
                            inValue = inValue + 1
                        ELSE
                            inValue = 0
                        ENDIF
                        IF openSide <> 0 AND inValue = 2 AND reEntered = 0 THEN
                            reEntered = 1
                            sigSide = -openSide
                            sigKind = 2
                        ENDIF
                    ENDIF
                    // tails: the bracket before this one made the session extreme and
                    // nobody traded those rows again, neither before nor in this bracket
                    xm = ROUND(($cX1[c - 1] + $cX2[c - 1]) / 2)
                    tailLo = FLOOR(MIN(lowBefore, $cLo[c]) / rowSize) - FLOOR($cLo[c - 1] / rowSize)
                    tailHi = FLOOR($cHi[c - 1] / rowSize) - FLOOR(MAX(highBefore, $cHi[c]) / rowSize)
                    IF tailLo >= tailRows THEN
                        sigSide = 1
                        sigKind = 1
                        IF c - 1 >= firstShown THEN
                            DRAWTEXT("Buying tail", xm, (FLOOR($cLo[c - 1] / rowSize) - 0.6) * rowSize, SansSerif, Bold, 11) COLOURED(buyR, buyG, buyB) ONPRICE
                        ENDIF
                    ENDIF
                    IF tailHi >= tailRows THEN
                        sigSide = -1
                        sigKind = 1
                        IF c - 1 >= firstShown THEN
                            DRAWTEXT("Selling tail", xm, (FLOOR($cHi[c - 1] / rowSize) + 1.6) * rowSize, SansSerif, Bold, 11) COLOURED(sellR, sellG, sellB) ONPRICE
                        ENDIF
                    ENDIF
                    IF sigKind > 0 THEN
                        $gX[nSig] = $cX1[c + 1]
                        $gSide[nSig] = sigSide
                        $gKind[nSig] = sigKind
                        nSig = nSig + 1
                    ENDIF
                ENDIF
                lowBefore = MIN(lowBefore, $cLo[c - 1])
                highBefore = MAX(highBefore, $cHi[c - 1])
            ENDIF
        NEXT

        // 10. the signals, on the candles and on the delta
        FOR g = 0 TO nSig - 1 DO
            IF $gX[g] >= xShown THEN
                back = barindex - $gX[g]
                sigName = "OTF ends"
                IF $gKind[g] = 1 THEN
                    sigName = "Tail"
                ELSIF $gKind[g] = 2 THEN
                    sigName = "Value"
                ENDIF
                IF $gSide[g] > 0 THEN
                    DRAWARROWUP($gX[g], low[back] - 0.6 * rowSize) COLOURED(inkR, inkG, inkB) ONPRICE
                    DRAWTEXT(sigName, $gX[g], low[back] - 1.4 * rowSize, SansSerif, Standard, 10) COLOURED(inkR, inkG, inkB) ONPRICE
                    DRAWARROWUP($gX[g], sessDelta[back]) COLOURED(inkR, inkG, inkB)
                ELSE
                    DRAWARROWDOWN($gX[g], high[back] + 0.6 * rowSize) COLOURED(inkR, inkG, inkB) ONPRICE
                    DRAWTEXT(sigName, $gX[g], high[back] + 1.4 * rowSize, SansSerif, Standard, 10) COLOURED(inkR, inkG, inkB) ONPRICE
                    DRAWARROWDOWN($gX[g], sessDelta[back]) COLOURED(inkR, inkG, inkB)
                ENDIF
            ENDIF
        NEXT

        // 11. the state of the auction and the journal
        IF journalRows > 0 THEN
            valueTxt = "one session only"
            IF nSes > 1 THEN
                vah0 = $sVah[nSes - 2]
                val0 = $sVal[nSes - 2]
                vah1 = $sVah[nSes - 1]
                val1 = $sVal[nSes - 1]
                IF val1 >= vah0 THEN
                    valueTxt = "higher"
                ELSIF vah1 <= val0 THEN
                    valueTxt = "lower"
                ELSIF vah1 > vah0 AND val1 > val0 THEN
                    valueTxt = "overlapping higher"
                ELSIF vah1 < vah0 AND val1 < val0 THEN
                    valueTxt = "overlapping lower"
                ELSIF vah1 <= vah0 AND val1 >= val0 THEN
                    valueTxt = "inside"
                ELSE
                    valueTxt = "outside"
                ENDIF
            ENDIF
            controlTxt = "two-sided"
            IF runUp >= otfMin AND runUp > runDn THEN
                controlTxt = "buyers"
            ELSIF runDn >= otfMin AND runDn > runUp THEN
                controlTxt = "sellers"
            ENDIF
            TABLEMERGE(tb, 0, 0, 1, 4)
            TABLEMERGE(tb, 1, 0, 1, 4)
            TABLECELL(tb, 0, 0, "Value against the previous session: " + valueTxt, bold, left)
            TABLECELL(tb, 1, 0, "Control: " + controlTxt, bold, left)
            TABLECELL(tb, 2, 0, "Time", left) COLOURED(dimR, dimG, dimB)
            TABLECELL(tb, 2, 1, "Signal", left) COLOURED(dimR, dimG, dimB)
            TABLECELL(tb, 2, 2, "Price", right) COLOURED(dimR, dimG, dimB)
            TABLECELL(tb, 2, 3, "Since (%)", right) COLOURED(dimR, dimG, dimB)
            FOR j = 0 TO journalRows - 1 DO
                g = nSig - 1 - j
                IF g >= 0 THEN
                    back = barindex - $gX[g]
                    hh = OpenHour[back]
                    mm = OpenMinute[back]
                    sigPrice = open[back]
                    // the move since the signal, in percent, counted in its own direction
                    since = ROUND((close / sigPrice - 1) * $gSide[g] * 10000) / 100
                    sigName = "One-time framing ends"
                    IF $gKind[g] = 1 THEN
                        sigName = "Tail"
                    ELSIF $gKind[g] = 2 THEN
                        sigName = "Value re-entry"
                    ENDIF
                    // the time is dimmed when the signal belongs to an earlier session
                    timeR = inkR
                    timeG = inkG
                    timeB = inkB
                    IF $gX[g] < $cX1[$sFirst[nSes - 1]] THEN
                        timeR = dimR
                        timeG = dimG
                        timeB = dimB
                    ENDIF
                    IF mm < 10 THEN
                        TABLECELL(tb, 3 + j, 0, "#hh#:0#mm#", left) COLOURED(timeR, timeG, timeB)
                    ELSE
                        TABLECELL(tb, 3 + j, 0, "#hh#:#mm#", left) COLOURED(timeR, timeG, timeB)
                    ENDIF
                    IF $gSide[g] > 0 THEN
                        TABLECELL(tb, 3 + j, 1, sigName + ", buy side", left) COLOURED(buyR, buyG, buyB)
                    ELSE
                        TABLECELL(tb, 3 + j, 1, sigName + ", sell side", left) COLOURED(sellR, sellG, sellB)
                    ENDIF
                    TABLECELL(tb, 3 + j, 2, "#sigPrice#", right)
                    TABLECELL(tb, 3 + j, 3, "#since#", right)
                ENDIF
            NEXT
        ENDIF

        // 12. the alert: a signal born on this very candle
        IF nSig > 0 THEN
            IF $gX[nSig - 1] = barindex THEN
                aSide = $gSide[nSig - 1]
                aKind = $gKind[nSig - 1]
                IF aKind = 1 AND aSide > 0 THEN
                    alert("Bracket Footprint", "Buying tail confirmed, price #close#", onceperbar, 1, {signal: "tail", side: aSide, price: close})
                ELSIF aKind = 1 THEN
                    alert("Bracket Footprint", "Selling tail confirmed, price #close#", onceperbar, 1, {signal: "tail", side: aSide, price: close})
                ELSIF aKind = 2 AND aSide > 0 THEN
                    alert("Bracket Footprint", "Back inside the previous value area from below, price #close#", onceperbar, 1, {signal: "value", side: aSide, price: close})
                ELSIF aKind = 2 THEN
                    alert("Bracket Footprint", "Back inside the previous value area from above, price #close#", onceperbar, 1, {signal: "value", side: aSide, price: close})
                ELSIF aSide > 0 THEN
                    alert("Bracket Footprint", "Sellers lost control, price #close#", onceperbar, 1, {signal: "otf", side: aSide, price: close})
                ELSE
                    alert("Bracket Footprint", "Buyers lost control, price #close#", onceperbar, 1, {signal: "otf", side: aSide, price: close})
                ENDIF
            ENDIF
        ENDIF
    ENDIF
ENDIF

// ---------- The delta panel
deltaR = sellR
deltaG = sellG
deltaB = sellB
IF sessDelta >= 0 THEN
    deltaR = buyR
    deltaG = buyG
    deltaB = buyB
ENDIF
COLORBETWEEN(sessDelta, 0, deltaR, deltaG, deltaB, 70)
RETURN sessDelta AS "Session delta" COLOURED(deltaR, deltaG, deltaB) STYLE(line, 2), 0 AS "Zero" COLOURED(dimR, dimG, dimB)
No ITF file for this code
A Studio Only code is not imported into ProRealTime™. Copy it and paste it into the ProRealCode Studio editor.
Nicolas
Nicolas Legend
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

ProRealCode ProRealCode
Loading...