Iván González

True FVG+: Fair Value Gaps Validated Against the Volume Profile

Category: Indicators By: Iván González Created: November 23, 2026, 11:43 AM
November 23, 2026, 11:43 AM
Indicators
0 Comments
True FVG+: Fair Value Gaps Validated Against the Volume Profile

Introduction

 

Not every fair value gap is the same. Some form in a part of the range where very little has traded, and price tends to react when it comes back to them; others form in the middle of heavy two-sided trade and mean little. True FVG+ by arleay separates the two: every three-candle gap is measured against a volume profile, and only the gaps that sit in a low volume node (LVN) are kept as “true” gaps.

It also keeps score. Each touched gap is followed until it either holds (price moves away from it by one ATR) or fails (price closes through it), separately for LVN gaps and for the rest, so the panel tells you whether the filter is actually adding something on the instrument you are looking at.

Theory Behind the Indicator

 

A bullish gap appears when the low of a candle is above the high of the candle two bars earlier; a bearish gap when the high is below the low two bars earlier. Gaps smaller than the minimum number of ticks are ignored.

The volume profile is built from the candles of the current day plus the prior day by default (or the current day only, or the current week plus the prior week). Each candle’s volume is spread evenly over the price rows it covers. Rows are about 0.005 % of price unless a fixed size in ticks is set.

When a gap forms, the profile as it stands on that candle is used to compute the volume per unit of price inside the gap and compare it two ways:

  • Local: against the heaviest three-row average on the thinner side of the gap, read within two gap heights above and below (at least three rows). The gap passes if the ratio is 0.5 or lower.
  • Overall: against the average volume per unit of price of the whole profile. The gap passes if the ratio is 0.5 or lower.

By default a gap must pass both to be an LVN gap. A gap ends when a candle closes through its far edge (or, as options, when a wick goes through it or when price closes past its midline), and it expires after 48 hours.

Key Features at a Glance

 

  • Three-candle gaps with a minimum size in ticks.
  • Validation against a day, day + prior day or week + prior week volume profile.
  • Local, overall or combined test, with adjustable limits and side window.
  • Held / failed statistics for LVN gaps and for the other gaps, to compare.
  • Minimal view (live LVN gaps only) or full view (also gaps that failed the test and ended LVN gaps), plus an optional history of ended LVN gaps.
  • Midline (consequent encroachment), tags with the optional ratio, optional display of the profile itself.

How to Read the Indicator

 

  • Green box: live bullish LVN gap. Pink box: live bearish LVN gap. Faded boxes are ended gaps or, in full view, gaps that did not pass the volume test (grey).
  • Dotted line: the midline of the gap.
  • Tag: “LVN” for validated gaps, “fvg” for the others; with the ratio option on, the measured ratio in %.
  • Panel: the profile in use, live gap counts, how many measured gaps were LVN, and the held rate of touched LVN gaps against the held rate of the others. If the two rates are similar, the filter is not helping on that market and timeframe.

Practical Applications

 

  • Entry zones: wait for price to come back into a live LVN gap in the direction of the gap.
  • Filtering ICT setups: use only the gaps that pass the volume test instead of every imbalance on the chart.
  • Market selection: compare the held rates across instruments and timeframes before trusting the gaps on a new market.
  • Targets: an opposite live LVN gap is a natural target, since thin areas tend to be crossed quickly.

Indicator Configuration

 

  • minTicks (default 2): minimum gap size in ticks.
  • endMode (default 0): the gap ends on 0 = close through, 1 = wick through, 2 = close past the midline.
  • maxAgeH (default 48): hours after which an open gap expires.
  • profMode (default 1): 0 = day, 1 = day + prior day, 2 = week + prior week.
  • valMode (default 0): 0 = both tests, 1 = local, 2 = overall.
  • valleyLim (default 0.5): local limit (lower is stricter).
  • globalLim (default 0.5): overall limit (lower is stricter).
  • sideMult (default 2.0): side window in gap heights.
  • rowTicks (default 0): row size in ticks, 0 = auto (about 0.005 % of price). A gap narrower than one row is not measured.
  • reactATR (default 1.0): distance in 14-bar ATRs that makes a touched gap count as held.
  • fullView (default 0): 0 = live LVN gaps only, 1 = full view.
  • liveN (default 4), otherN (default 3), endN (default 2): gaps drawn per side in each group.
  • showCE, showTags (default 1) and tagRatio (default 0): midline, tags and ratio in the tag.
  • showHist (default 0) and histN (default 20): keep the most recent ended LVN gaps on the chart.
  • boxTr (default 88): box transparency.
  • showPanel (default 1) and compactPanel (default 0).
  • showProfile (default 0), vpRows (default 200) and vpWidth (default 25): draw the profile from where it starts.

The chart must be daily or lower. Instruments without volume cannot be measured: every gap then stays as a plain “fvg”.

The Code

 

//---------------------------------------------------------------
// PRC_True FVG+
// version = 0
// 23.11.2026
// Iván González @ www.prorealcode.com
// Author: arleay
// Sharing ProRealTime knowledge
//--------------------------------------------------------------------//
defparam drawonlastbaronly = true
//--------------------------------------------------------------------//
// Inputs
//--------------------------------------------------------------------//
// Gaps
minTicks = 2          // minimum gap size in ticks
endMode = 0           // gap ends on: 0 = close through, 1 = wick through, 2 = close past CE (midline)
maxAgeH = 48          // max age in hours: a gap still open after this stops and counts as expired
// Validation
profMode = 1          // profile: 0 = day, 1 = day + prior day, 2 = week + prior week
valMode = 0           // validate with: 0 = both, 1 = local, 2 = overall
valleyLim = 0.5       // local limit: gap volume per price / heaviest volume per price on its thinner side
globalLim = 0.5       // overall limit: gap volume per price / average volume per price of the profile
sideMult = 2.0        // side window, in gap heights (at least 3 rows)
rowTicks = 0          // row size in ticks, 0 = auto (about 0.005% of price)
// Stats
reactATR = 1.0        // a touched gap counts as held once price moves this many 14-bar ATRs away from it
// Display
fullView = 0          // 0 = minimal (live LVN gaps only), 1 = full (also failed, faded and ended LVN gaps)
liveN = 4             // live LVN gaps drawn per side
otherN = 3            // other gaps drawn per side (full view)
endN = 2              // ended LVN gaps drawn per side (full view)
showCE = 1            // midline of the LVN gaps
showTags = 1          // tags
tagRatio = 0          // ratio in the tag
showHist = 0          // keep ended LVN gaps on the chart, faded, in either view
histN = 20            // most recent ended LVN gaps drawn per side
boxTr = 88            // box transparency (50..98)
showPanel = 1         // panel
compactPanel = 0      // compact panel
// Profile display
showProfile = 0       // draw the profile the gaps are measured against
vpRows = 200          // rows drawn
vpWidth = 25          // width, % of the profile period
//--------------------------------------------------------------------//
// Day and week of the bars
//--------------------------------------------------------------------//
TIMEFRAME(weekly)
wkO = open
wkPH = high[1]
wkPL = low[1]
wkPC = close[1]
TIMEFRAME(daily)
dyO = open
dyPH = high[1]
dyPL = low[1]
dyPC = close[1]
TIMEFRAME(default)

newDay = 0
newWk = 0
IF barindex = 0 THEN
   newDay = 1
   newWk = 1
ELSE
   IF dyO <> dyO[1] OR dyPH <> dyPH[1] OR dyPL <> dyPL[1] OR dyPC <> dyPC[1] THEN
      newDay = 1
   ENDIF
   IF wkO <> wkO[1] OR wkPH <> wkPH[1] OR wkPL <> wkPL[1] OR wkPC <> wkPC[1] THEN
      newWk = 1
   ENDIF
ENDIF
IF profMode = 2 THEN
   newPer = newWk
ELSE
   newPer = newDay
ENDIF
atrV = averagetruerange[14](close)

ONCE binSz = 0
IF barindex = 0 THEN
   IF rowTicks > 0 THEN
      binSz = rowTicks * ticksize
   ELSE
      binSz = max(ticksize, round(close * 0.00005 / ticksize) * ticksize)
   ENDIF
ENDIF
twoP = 0
IF profMode <> 0 THEN
   twoP = 1
ENDIF

//--------------------------------------------------------------------//
// All the engine state lives in arrays and the last CLOSED bar is processed
// once, on the first tick of the next one: arrays are NOT rewound between
// ticks the way scalars are, so a second pass would count everything twice.
//--------------------------------------------------------------------//
IF barindex = 0 THEN
   $guard[0] = -1
   $nG[0] = 0           // gaps created
   $nLv[0] = 0          // live gaps
   $nEn[0] = 0          // ended LVN gaps
   FOR j = 0 TO 5 DO
      $stat[j] = 0      // 0 LVN made, 1 other made, 2 LVN touched, 3 LVN held, 4 other touched, 5 other held
   NEXT
   FOR j = 0 TO 5 DO
      $cur[j] = 0       // current profile period: 0 start bar, 1 bars, 2 volume, 3 low row, 4 high row, 5 rows set
      $prv[j] = 0       // previous profile period
   NEXT
ENDIF

IF barindex > 0 AND $guard[0] < barindex THEN
   $guard[0] = barindex
   bb = barindex - 1
   bH = high[1]
   bL = low[1]
   bC = close[1]
   bV = volume[1]
   bTs = opentimestamp[1]
   // ---- profile: a new period moves the current one to "prior"
   IF newPer[1] = 1 AND $cur[1] > 0 THEN
      FOR j = 0 TO 5 DO
         $prv[j] = $cur[j]
         $cur[j] = 0
      NEXT
   ENDIF
   IF $cur[1] = 0 THEN
      $cur[0] = bb
   ENDIF
   $cur[1] = $cur[1] + 1
   r0 = floor(bL / binSz + 0.000001)
   r1 = floor(bH / binSz + 0.000001)
   $bR0[bb] = r0
   $bR1[bb] = r1
   IF bV > 0 THEN
      $bVol[bb] = bV
      $cur[2] = $cur[2] + bV
   ELSE
      $bVol[bb] = 0
   ENDIF
   IF $cur[5] = 0 THEN
      $cur[3] = r0
      $cur[4] = r1
      $cur[5] = 1
   ELSE
      $cur[3] = min($cur[3], r0)
      $cur[4] = max($cur[4], r1)
   ENDIF

   // ---- live gaps: touch, held, end
   nLvNow = $nLv[0]
   IF nLvNow > 0 THEN
      FOR i = nLvNow - 1 DOWNTO 0 DO
         g = $lv[i]
         gd = $gDir[g]
         gTop = $gTop[g]
         gBot = $gBot[g]
         gMid = (gTop + gBot) / 2
         touchNow = 0
         IF gd = 1 AND bL <= gTop THEN
            touchNow = 1
         ENDIF
         IF gd = -1 AND bH >= gBot THEN
            touchNow = 1
         ENDIF
         reach = 0
         IF gd = 1 AND bH >= gTop + reactATR * $gAtr[g] THEN
            reach = 1
         ENDIF
         IF gd = -1 AND bL <= gBot - reactATR * $gAtr[g] THEN
            reach = 1
         ENDIF
         doCount = 0
         IF $gTch[g] = 0 AND touchNow = 1 THEN
            $gTch[g] = 1
         ELSIF $gTch[g] = 1 AND $gOut[g] = 0 AND reach = 1 THEN
            $gOut[g] = 1
            doCount = 1
         ENDIF
         mit = 0
         IF endMode = 1 THEN
            IF gd = 1 AND bL < gBot THEN
               mit = 1
            ENDIF
            IF gd = -1 AND bH > gTop THEN
               mit = 1
            ENDIF
         ELSIF endMode = 0 THEN
            IF gd = 1 AND bC < gBot THEN
               mit = 1
            ENDIF
            IF gd = -1 AND bC > gTop THEN
               mit = 1
            ENDIF
         ELSE
            IF gd = 1 AND bC < gMid THEN
               mit = 1
            ENDIF
            IF gd = -1 AND bC > gMid THEN
               mit = 1
            ENDIF
         ENDIF
         tooOld = 0
         IF bTs - $gTs[g] > maxAgeH * 3600 THEN
            tooOld = 1
         ENDIF
         IF mit = 1 OR tooOld = 1 THEN
            IF mit = 1 THEN
               $gSt[g] = 1
            ELSE
               $gSt[g] = 2
            ENDIF
            $gEnd[g] = bb
            IF mit = 1 AND $gOut[g] = 0 THEN
               $gTch[g] = 1
               $gOut[g] = -1
               doCount = 1
            ENDIF
         ENDIF
         // a measured gap is counted once, when its outcome is known
         IF doCount = 1 AND $gMeas[g] = 1 AND $gCnt[g] = 0 THEN
            $gCnt[g] = 1
            IF $gOk[g] = 1 THEN
               sb = 2
            ELSE
               sb = 4
            ENDIF
            $stat[sb] = $stat[sb] + 1
            IF $gOut[g] = 1 THEN
               $stat[sb + 1] = $stat[sb + 1] + 1
            ENDIF
         ENDIF
         IF mit = 1 OR tooOld = 1 THEN
            // remove from the live list
            IF i < nLvNow - 1 THEN
               FOR j = i TO nLvNow - 2 DO
                  $lv[j] = $lv[j + 1]
               NEXT
            ENDIF
            nLvNow = nLvNow - 1
            IF $gOk[g] = 1 THEN
               nEnNow = $nEn[0]
               $en[nEnNow] = g
               $nEn[0] = nEnNow + 1
            ENDIF
         ENDIF
      NEXT
      $nLv[0] = nLvNow
   ENDIF

   // ---- new gap on the bar just closed (3-candle gap)
   IF bb >= 2 THEN
      minG = minTicks * ticksize
      bullG = 0
      bearG = 0
      IF bL > high[3] AND bL - high[3] >= minG THEN
         bullG = 1
      ENDIF
      IF bH < low[3] AND low[3] - bH >= minG THEN
         bearG = 1
      ENDIF
      IF bullG = 1 OR bearG = 1 THEN
         g = $nG[0]
         $nG[0] = g + 1
         IF bullG = 1 THEN
            $gDir[g] = 1
            $gTop[g] = bL
            $gBot[g] = high[3]
         ELSE
            $gDir[g] = -1
            $gTop[g] = low[3]
            $gBot[g] = bH
         ENDIF
         $gX0[g] = bb - 2
         $gTs[g] = bTs
         $gAtr[g] = atrV[1]
         $gMeas[g] = 0
         $gOk[g] = 0
         $gRL[g] = -1
         $gRG[g] = -1
         $gSt[g] = 0
         $gEnd[g] = -1
         $gTch[g] = 0
         $gOut[g] = 0
         $gCnt[g] = 0
         // ---- measure the gap against the profile as it stands on this bar
         gTop = $gTop[g]
         gBot = $gBot[g]
         gh = gTop - gBot
         totV = $cur[2]
         nBars = $cur[1]
         loOk = $cur[5]
         loR = $cur[3]
         hiR = $cur[4]
         startB = $cur[0]
         IF twoP = 1 THEN
            totV = totV + $prv[2]
            nBars = nBars + $prv[1]
            IF $prv[5] = 1 THEN
               IF loOk = 1 THEN
                  loR = min(loR, $prv[3])
                  hiR = max(hiR, $prv[4])
               ELSE
                  loR = $prv[3]
                  hiR = $prv[4]
                  loOk = 1
               ENDIF
            ENDIF
            IF $prv[1] > 0 THEN
               startB = $prv[0]
            ENDIF
         ENDIF
         why = 0
         IF gh < binSz THEN
            why = 1
         ELSIF nBars < 10 OR totV <= 0 OR loOk = 0 THEN
            why = 2
         ENDIF
         IF why = 0 THEN
            cS = sideMult * gh / binSz
            nS = floor(cS)
            IF nS < cS THEN
               nS = nS + 1
            ENDIF
            nS = max(3, nS)
            kA0 = floor(gTop / binSz) + 1
            kB1 = floor(gBot / binSz) - 1
            wLo = kB1 - nS + 1
            wHi = kA0 + nS - 1
            FOR j = 0 TO wHi - wLo DO
               $rv[j] = 0
            NEXT
            // volume per row inside the window, bar by bar (same spreading as the profile)
            FOR jb = startB TO bb DO
               vb = $bVol[jb]
               IF vb > 0 THEN
                  q0 = $bR0[jb]
                  q1 = $bR1[jb]
                  cntR = q1 - q0 + 1
                  stp = max(1, floor((cntR + 299) / 300))
                  shr = vb * stp / cntR
                  rr = q0
                  IF wLo > q0 THEN
                     rr = q0 + stp * floor((wLo - q0 + stp - 1) / stp)
                  ENDIF
                  rEnd = min(q1, wHi)
                  WHILE rr <= rEnd DO
                     $rv[rr - wLo] = $rv[rr - wLo] + shr
                     rr = rr + stp
                  WEND
               ENDIF
            NEXT
            // volume per price inside the gap
            k0 = floor(gBot / binSz)
            k1 = floor(gTop / binSz)
            volIn = 0
            FOR kk = k0 TO k1 DO
               ov = min((kk + 1) * binSz, gTop) - max(kk * binSz, gBot)
               IF ov > 0 THEN
                  volIn = volIn + $rv[kk - wLo] * ov / binSz
               ENDIF
            NEXT
            gapD = volIn / gh
            // heaviest 3-row average above and below the gap
            pkA = 0
            FOR kk = kA0 + 1 TO kA0 + nS - 2 DO
               pkA = max(pkA, ($rv[kk - 1 - wLo] + $rv[kk - wLo] + $rv[kk + 1 - wLo]) / 3)
            NEXT
            pkA = pkA / binSz
            pkB = 0
            FOR kk = kB1 - nS + 2 TO kB1 - 1 DO
               pkB = max(pkB, ($rv[kk - 1 - wLo] + $rv[kk - wLo] + $rv[kk + 1 - wLo]) / 3)
            NEXT
            pkB = pkB / binSz
            sideV = min(pkA, pkB)
            avgD = totV / ((hiR - loR + 1) * binSz)
            okL = 0
            okG = 0
            IF sideV > 0 THEN
               $gRL[g] = gapD / sideV
               IF $gRL[g] <= valleyLim THEN
                  okL = 1
               ENDIF
            ENDIF
            IF avgD > 0 THEN
               $gRG[g] = gapD / avgD
               IF $gRG[g] <= globalLim THEN
                  okG = 1
               ENDIF
            ENDIF
            $gMeas[g] = 1
            IF valMode = 1 THEN
               $gOk[g] = okL
            ELSIF valMode = 2 THEN
               $gOk[g] = okG
            ELSE
               $gOk[g] = okL * okG
            ENDIF
            IF $gOk[g] = 1 THEN
               $stat[0] = $stat[0] + 1
            ELSE
               $stat[1] = $stat[1] + 1
            ENDIF
         ENDIF
         // push to the live list, at most 200 live gaps (the oldest is dropped)
         nLvNow = $nLv[0]
         $lv[nLvNow] = g
         nLvNow = nLvNow + 1
         IF nLvNow > 200 THEN
            FOR j = 0 TO nLvNow - 2 DO
               $lv[j] = $lv[j + 1]
            NEXT
            nLvNow = nLvNow - 1
         ENDIF
         $nLv[0] = nLvNow
      ENDIF
   ENDIF
ENDIF

//--------------------------------------------------------------------//
// Drawing
//--------------------------------------------------------------------//
IF islastbarupdate THEN
   boxA = round(255 * (100 - boxTr) / 100)
   boxAf = round(255 * (100 - min(98, boxTr + 6)) / 100)
   // ---- profile
   IF showProfile = 1 THEN
      use2 = 0
      IF twoP = 1 AND $prv[1] > 0 THEN
         use2 = 1
      ENDIF
      pLoOk = $cur[5]
      pLo = $cur[3]
      pHi = $cur[4]
      x0 = $cur[0]
      IF use2 = 1 THEN
         x0 = $prv[0]
         IF $prv[5] = 1 THEN
            IF pLoOk = 1 THEN
               pLo = min(pLo, $prv[3])
               pHi = max(pHi, $prv[4])
            ELSE
               pLo = $prv[3]
               pHi = $prv[4]
               pLoOk = 1
            ENDIF
         ENDIF
      ENDIF
      IF pLoOk = 1 AND pHi > pLo AND $cur[1] > 0 THEN
         nbR = pHi - pLo + 1
         grp = max(1, floor((nbR + vpRows - 1) / vpRows))
         nRows = floor((nbR + grp - 1) / grp)
         FOR j = 0 TO nRows - 1 DO
            $pv[j] = 0
         NEXT
         FOR jb = x0 TO barindex - 1 DO
            vb = $bVol[jb]
            IF vb > 0 THEN
               q0 = $bR0[jb]
               q1 = $bR1[jb]
               cntR = q1 - q0 + 1
               stp = max(1, floor((cntR + 299) / 300))
               shr = vb * stp / cntR
               rr = q0
               WHILE rr <= q1 DO
                  ri = max(0, min(nRows - 1, floor((rr - pLo) / grp)))
                  $pv[ri] = $pv[ri] + shr
                  rr = rr + stp
               WEND
            ENDIF
         NEXT
         mxV = 0
         FOR j = 0 TO nRows - 1 DO
            mxV = max(mxV, $pv[j])
         NEXT
         wBars = max(barindex - x0, 20) * vpWidth / 100
         IF mxV > 0 THEN
            FOR j = 0 TO nRows - 1 DO
               IF $pv[j] > 0 THEN
                  yRow = (pLo + (j + 0.5) * grp) * binSz
                  DRAWSEGMENT(x0, yRow, x0 + round(wBars * $pv[j] / mxV), yRow) COLOURED(0, 0, 0, 26) STYLE(line, 1)
               ENDIF
            NEXT
         ENDIF
      ENDIF
   ENDIF

   // ---- gaps, newest first, one side at a time
   nUp = 0
   nDn = 0
   nOth = 0
   endMax = 0
   IF showHist = 1 THEN
      endMax = histN
   ENDIF
   IF fullView = 1 THEN
      endMax = max(endMax, endN)
   ENDIF
   FOR sd = 0 TO 1 DO
      IF sd = 0 THEN
         dWant = 1
      ELSE
         dWant = -1
      ENDIF
      nV = 0
      nO = 0
      nE = 0
      // live gaps first, ended ones after
      nLvNow = $nLv[0]
      nEnNow = $nEn[0]
      eStop = max(0, nEnNow - 250)
      nItems = nLvNow + nEnNow - eStop
      IF nItems > 0 THEN
         FOR it = 0 TO nItems - 1 DO
            drawIt = 0
            IF it < nLvNow THEN
               g = $lv[nLvNow - 1 - it]
               IF $gDir[g] = dWant THEN
                  IF $gOk[g] = 1 THEN
                     IF dWant = 1 THEN
                        nUp = nUp + 1
                     ELSE
                        nDn = nDn + 1
                     ENDIF
                     IF nV < liveN THEN
                        drawIt = 1
                        fade = 0
                        gx2 = barindex
                        nV = nV + 1
                     ENDIF
                  ELSE
                     nOth = nOth + 1
                     IF fullView = 1 AND nO < otherN THEN
                        drawIt = 1
                        fade = 1
                        gx2 = barindex
                        nO = nO + 1
                     ENDIF
                  ENDIF
               ENDIF
            ELSE
               g = $en[nEnNow - 1 - (it - nLvNow)]
               IF $gDir[g] = dWant AND $gOk[g] = 1 AND nE < endMax THEN
                  drawIt = 1
                  fade = 1
                  gx2 = $gEnd[g]
                  nE = nE + 1
               ENDIF
            ENDIF
            IF drawIt = 1 THEN
               gTop = $gTop[g]
               gBot = $gBot[g]
               gMid = (gTop + gBot) / 2
               gx1 = $gX0[g]
               IF fade = 1 THEN
                  aBox = boxAf
                  aLine = 102
                  aTag = 115
               ELSE
                  aBox = boxA
                  aLine = 255
                  aTag = 255
               ENDIF
               IF $gOk[g] = 1 AND $gDir[g] = 1 THEN
                  DRAWRECTANGLE(gx1, gTop, gx2, gBot) COLOURED(27, 158, 134, 0) FILLCOLOR(27, 158, 134, aBox)
               ELSIF $gOk[g] = 1 THEN
                  DRAWRECTANGLE(gx1, gTop, gx2, gBot) COLOURED(218, 89, 125, 0) FILLCOLOR(218, 89, 125, aBox)
               ELSE
                  DRAWRECTANGLE(gx1, gTop, gx2, gBot) COLOURED(120, 123, 134, 0) FILLCOLOR(120, 123, 134, aBox)
               ENDIF
               IF showCE = 1 AND $gOk[g] = 1 THEN
                  DRAWSEGMENT(gx1, gMid, gx2, gMid) COLOURED(0, 0, 0, aLine) STYLE(dottedline, 1)
               ENDIF
               IF showTags = 1 THEN
                  IF valMode = 2 THEN
                     rTag = $gRG[g]
                  ELSE
                     rTag = $gRL[g]
                  ENDIF
                  rPct = round(rTag * 100)
                  tX = gx2 + 3
                  IF tagRatio = 1 AND $gMeas[g] = 1 THEN
                     IF rTag < 0 THEN
                        IF $gOk[g] = 1 THEN
                           DRAWTEXT("LVN n/a", tX, gMid, SansSerif, Standard, 8) COLOURED(0, 0, 0, aTag)
                        ELSE
                           DRAWTEXT("fvg n/a", tX, gMid, SansSerif, Standard, 8) COLOURED(0, 0, 0, aTag)
                        ENDIF
                     ELSIF $gOk[g] = 1 THEN
                        DRAWTEXT("LVN #rPct#%", tX, gMid, SansSerif, Standard, 8) COLOURED(0, 0, 0, aTag)
                     ELSE
                        DRAWTEXT("fvg #rPct#%", tX, gMid, SansSerif, Standard, 8) COLOURED(0, 0, 0, aTag)
                     ENDIF
                  ELSE
                     IF $gOk[g] = 1 THEN
                        DRAWTEXT("LVN", tX, gMid, SansSerif, Standard, 8) COLOURED(0, 0, 0, aTag)
                     ELSE
                        DRAWTEXT("fvg", tX, gMid, SansSerif, Standard, 8) COLOURED(0, 0, 0, aTag)
                     ENDIF
                  ENDIF
               ENDIF
            ENDIF
         NEXT
      ENDIF
   NEXT

   // ---- panel, anchored to the top right corner of the window
   IF showPanel = 1 THEN
      cLab = -250
      cVal = -150
      pY = -20
      rowY = pY - 18
      DRAWTEXT("True FVG+", cLab, pY, SansSerif, Bold, 10) COLOURED(0, 0, 0, 255) ANCHOR(topright, xshift, yshift)
      IF compactPanel = 0 THEN
         DRAWTEXT("Profile", cLab, rowY, SansSerif, Standard, 9) COLOURED(0, 0, 0, 140) ANCHOR(topright, xshift, yshift)
         IF profMode = 0 THEN
            DRAWTEXT("day, chart bars", cVal, rowY, SansSerif, Standard, 9) COLOURED(0, 0, 0, 255) ANCHOR(topright, xshift, yshift)
         ELSIF profMode = 1 THEN
            DRAWTEXT("day + prior day, chart bars", cVal, rowY, SansSerif, Standard, 9) COLOURED(0, 0, 0, 255) ANCHOR(topright, xshift, yshift)
         ELSE
            DRAWTEXT("week + prior week, chart bars", cVal, rowY, SansSerif, Standard, 9) COLOURED(0, 0, 0, 255) ANCHOR(topright, xshift, yshift)
         ENDIF
         rowY = rowY - 18
         DRAWTEXT("Live", cLab, rowY, SansSerif, Standard, 9) COLOURED(0, 0, 0, 140) ANCHOR(topright, xshift, yshift)
         DRAWTEXT("LVN ↑#nUp# ↓#nDn# · other #nOth#", cVal, rowY, SansSerif, Standard, 9) COLOURED(0, 0, 0, 255) ANCHOR(topright, xshift, yshift)
         rowY = rowY - 18
         nLvn = $stat[0]
         nMade = $stat[0] + $stat[1]
         DRAWTEXT("Made", cLab, rowY, SansSerif, Standard, 9) COLOURED(0, 0, 0, 140) ANCHOR(topright, xshift, yshift)
         IF nMade > 0 THEN
            madePct = round(100 * nLvn / nMade)
            DRAWTEXT("#nLvn# LVN of #nMade# (#madePct#%)", cVal, rowY, SansSerif, Standard, 9) COLOURED(0, 0, 0, 255) ANCHOR(topright, xshift, yshift)
         ELSE
            DRAWTEXT("#nLvn# LVN of #nMade#", cVal, rowY, SansSerif, Standard, 9) COLOURED(0, 0, 0, 255) ANCHOR(topright, xshift, yshift)
         ENDIF
         rowY = rowY - 18
      ENDIF
      DRAWTEXT("LVN held", cLab, rowY, SansSerif, Standard, 9) COLOURED(0, 0, 0, 140) ANCHOR(topright, xshift, yshift)
      tchL = $stat[2]
      IF tchL > 0 THEN
         heldL = round(100 * $stat[3] / tchL)
         DRAWTEXT("#heldL#% of #tchL#", cVal, rowY, SansSerif, Standard, 9) COLOURED(0, 0, 0, 255) ANCHOR(topright, xshift, yshift)
      ELSE
         DRAWTEXT("no touches yet", cVal, rowY, SansSerif, Standard, 9) COLOURED(0, 0, 0, 255) ANCHOR(topright, xshift, yshift)
      ENDIF
      rowY = rowY - 18
      DRAWTEXT("Other held", cLab, rowY, SansSerif, Standard, 9) COLOURED(0, 0, 0, 140) ANCHOR(topright, xshift, yshift)
      tchO = $stat[4]
      IF tchO > 0 THEN
         heldO = round(100 * $stat[5] / tchO)
         DRAWTEXT("#heldO#% of #tchO#", cVal, rowY, SansSerif, Standard, 9) COLOURED(0, 0, 0, 255) ANCHOR(topright, xshift, yshift)
      ELSE
         DRAWTEXT("no touches yet", cVal, rowY, SansSerif, Standard, 9) COLOURED(0, 0, 0, 255) ANCHOR(topright, xshift, yshift)
      ENDIF
      rowY = rowY - 18
      DRAWTEXT("free · @arleaynt on X", cLab + 40, rowY, SansSerif, Standard, 9) COLOURED(0, 0, 0, 90) ANCHOR(topright, xshift, yshift)
   ENDIF
ENDIF

RETURN

Original author: arleay, published open source under the Mozilla Public License 2.0.

Download
Filename: PRC_True-FVG.itf
Downloads: 0
Iván González
Iván González Legend
I usually let my code do the talking, which explains why my bio is as empty as a newly created file. Bio to be initialized...
Author’s Profile

Comments

ProRealCode ProRealCode
Loading...