Iván González

Optimal Trade Entry and Silver Bullet

Category: Indicators By: Iván González Created: December 1, 2026, 4:53 PM
December 1, 2026, 4:53 PM
Indicators
0 Comments
Optimal Trade Entry and Silver Bullet

Introduction

 

Two ideas from the ICT school are behind this indicator. The first is the Optimal Trade Entry: after price breaks market structure, the best place to join the new move is a pullback into the 62% to 79% retracement of the leg that broke it, with 70.5% as the sweet spot. The second is the Silver Bullet: three one-hour windows of the trading day in which, according to that school, institutional order flow tends to leave fair value gaps and deliver the cleanest moves.

The indicator puts both on the price chart and joins them: it tracks the structure, draws the Fibonacci grid of the live leg, highlights the time windows, marks the fair value gaps and, when price taps the entry zone, draws a complete trade plan with entry, stop and two targets, graded from C to A+ by how many confluences line up.

Theory Behind the Indicator

 

Market structure. Swing highs and lows are pivots with 10 bars on each side. When a bar closes above the last swing high, structure turns bullish: a new leg starts at the last swing low and ends at the highest high, and it keeps stretching while price makes new highs. A close below the last swing low does the mirror. If the swing where the leg starts swept the previous one (a lower low before a bullish leg, a higher high before a bearish one), the leg is marked as having taken liquidity.

Fibonacci grid. On the live leg, 0 is the extreme and 1.0 the origin. The grid shows 0.5 (equilibrium), 0.618 and 0.79 (the edges of the entry zone), 0.705 (the sweet spot) and two extensions beyond the extreme as targets, at -0.27 and -0.62. The entry zone is shaded with a gradient that gets stronger towards 0.705. When structure breaks the other way, the grid is frozen as a completed setup and a new one starts.

Silver Bullet windows. London open, the New York morning session and the New York afternoon session: 03:00-04:00, 10:00-11:00 and 14:00-15:00 New York time, Monday to Friday. In the code they are written in Central European Time (09:00-10:00, 16:00-17:00 and 20:00-21:00), the time most ProRealTime charts show, and they only apply to intraday charts up to one hour.

Fair value gaps. A three-bar imbalance: the low of a bar above the high of two bars earlier (bullish) or the high below the low of two bars earlier (bearish), at least 0.15 ATR(14) wide. By default only gaps formed inside a window are drawn. Each gap extends to the right until price trades back to its far edge, and then it is greyed out.

Signal and grade. The signal is the first bar of the leg that trades into the entry zone and closes without crossing it: for a bullish leg, low at or below the 0.618 level and close at or above the 0.79 level. After a signal, a new one needs a new extreme of the leg. The grade adds one point for each confluence on top of the base point: inside a Silver Bullet window, a fair value gap printed inside a window during the leg, and a liquidity sweep at the origin. Four points is A+, three A, two B, one C.

Trade plan. Entry at the close of the signal bar, stop beyond the origin of the leg (or beyond the bar if it went further) plus 0.10 ATR, target one and target two at the extensions.

Key Features at a Glance

 

  • Automatic market structure with stretching legs and liquidity sweep detection.
  • Live Fibonacci grid with equilibrium, entry zone gradient, sweet spot and target extensions.
  • The last completed setups stay on the chart.
  • Silver Bullet windows highlighted, with a label when each one opens.
  • Fair value gaps that extend until mitigated, then turn grey.
  • Graded entry signals with a full trade plan.
  • Setup Monitor: grade, bias, retracement, zone status, sweet spot price, active window, gaps in the leg and liquidity sweep.

How to Read the Indicator

 

  • Directional Bias tells you which way structure broke last. Only signals in that direction are possible.
  • Retracement is how far price has pulled back into the live leg, in % of the leg. The zone starts at 61.8%.
  • Entry Zone: “Awaiting Pullback” while price is still above the zone in a bullish leg (below in a bearish one), “Inside Zone” when it is in, “Beyond Zone” when it went through it.
  • The signal label shows the direction and the grade. A+ and A setups combine the zone with the time window and the order flow footprint of the gap or the sweep; C is the zone alone.
  • The trade plan stays drawn for the last trades, so you can see how earlier signals played out against their stop and targets.

Practical Applications

 

  • Intraday index and forex trading: on 1 to 15-minute charts the windows, the gaps and the zone work together, which is how the method is usually traded.
  • Selective entries: switch on “require window” and “require gap” to keep only the signals with the strongest confluence.
  • Higher timeframes: on daily or 4-hour charts the windows do not apply, but the structure, the grid and the zone still give a clean pullback framework.
  • Planning: the targets at -0.27 and -0.62 come from the leg itself, so the reward to risk of every signal is visible before taking it.

Indicator Configuration

 

Market structure:

  • swingLen (default 10): bars on each side of a swing pivot. Higher values track larger structures.
  • keepSetups (default 3): completed setups kept on the chart.

Optimal Trade Entry:

  • showFib, showZone, showEq, showTgt (default 1): Fibonacci grid, entry zone gradient, equilibrium level and target extensions.
  • extendBars (default 16): bars the levels extend to the right.

Silver Bullet windows (chart time, HHMMSS):

  • showWin (default 1): highlight the windows.
  • useLO, loStart, loEnd (default 1, 090000, 100000): London open window.
  • useAM, amStart, amEnd (default 1, 160000, 170000): New York morning window.
  • usePM, pmStart, pmEnd (default 1, 200000, 210000): New York afternoon window.
  • If your chart is not on Central European Time, set these six times to the hours your chart shows for 03:00, 10:00 and 14:00 New York. For two or three weeks a year the United States and Europe are not on summer time at the same time, and the windows are one hour off.

Fair value gaps:

  • showFvg (default 1): show the gaps.
  • fvgWinOnly (default 1): only gaps formed inside a window.
  • fvgMinAtr (default 0.15): minimum gap size in ATR(14).
  • fvgKeep (default 10): gaps kept on the chart.

Signals and targets:

  • reqWin (default 0): signal only inside an active window.
  • reqFvg (default 0): signal only if the leg printed a gap inside a window.
  • tp1R / tp2R (default -0.27 / -0.62): target extension ratios.
  • slBuf (default 0.10): stop buffer in ATR(14).
  • keepTrades (default 3): trade plans kept on the chart.
  • showDash, dashX, dashY (default 1, -200, -20): Setup Monitor on/off and its position in pixels from the top right corner.

The Code

 

//---------------------------------------------------------------
// PRC_OTE Silver Bullet
// version = 0
// 01.12.2026
// Iván González @ www.prorealcode.com
// Author: Quantum-Algo
// Sharing ProRealTime knowledge
//--------------------------------------------------------------------//
// Apply ON THE PRICE CHART.
//
// Everything is drawn inside the "IF islastbarupdate" block at the end, from
// registers (completed setups, trade plans, fair value gaps, window labels)
// plus the live setup. That is a full redraw of the stored state, so the
// defparam is required.
//
// Silver Bullet windows are written in the CHART time, Central European
// Time (New York + 6 h): 09:00-10:00, 16:00-17:00 and 20:00-21:00,
// Monday to Friday. Change the six times below if your chart runs on another
// time zone. For two or three weeks a year the US and Europe are not on
// summer time at the same time and the windows move one hour.
//--------------------------------------------------------------------//
DEFPARAM drawonlastbaronly = true
//--------------------------------------------------------------------//
// --- Market structure ---
//--------------------------------------------------------------------//
swingLen   = 10     // Swing detection length (pivot bars on each side)
keepSetups = 3      // Completed setups to keep on the chart
//--------------------------------------------------------------------//
// --- Optimal Trade Entry ---
//--------------------------------------------------------------------//
showFib    = 1      // 1 = show the Fibonacci grid
showZone   = 1      // 1 = show the entry zone gradient (0.618 - 0.79)
showEq     = 1      // 1 = show the 0.5 equilibrium level
showTgt    = 1      // 1 = show the target extensions
extendBars = 16     // Extend levels to the right (bars)
//--------------------------------------------------------------------//
// --- Silver Bullet windows (chart time, HHMMSS) ---
//--------------------------------------------------------------------//
showWin = 1         // 1 = highlight the windows
useLO   = 1         // London Open window
loStart = 090000
loEnd   = 100000
useAM   = 1         // Morning Session window
amStart = 160000
amEnd   = 170000
usePM   = 1         // Afternoon Session window
pmStart = 200000
pmEnd   = 210000
//--------------------------------------------------------------------//
// --- Fair value gaps ---
//--------------------------------------------------------------------//
showFvg    = 1      // 1 = show fair value gaps
fvgWinOnly = 1      // 1 = only gaps that form inside a Silver Bullet window
fvgMinAtr  = 0.15   // Minimum gap size, in ATR(14)
fvgKeep    = 10     // Fair value gaps to keep
//--------------------------------------------------------------------//
// --- Signals and targets ---
//--------------------------------------------------------------------//
reqWin     = 0      // 1 = signal only inside an active Silver Bullet window
reqFvg     = 0      // 1 = signal only if the leg printed a gap inside a window
tp1R       = 0 - 0.27  // Target one extension ratio
tp2R       = 0 - 0.62  // Target two extension ratio
slBuf      = 0.10   // Stop buffer, in ATR(14)
keepTrades = 3      // Trade plans to keep
showDash   = 1      // 1 = show the dashboard (top right corner)
dashX      = 0 - 200   // dashboard: pixels from the right edge
dashY      = 0 - 20    // dashboard: pixels from the top edge
//--------------------------------------------------------------------//
// --- Colours (computed once) ---
//--------------------------------------------------------------------//
ONCE bullR = 38     // #26D0CE bullish
ONCE bullG = 208
ONCE bullB = 206
ONCE bearR = 247    // #F7567C bearish
ONCE bearG = 86
ONCE bearB = 124
ONCE goldR = 232    // #E8B64C sweet spot
ONCE goldG = 182
ONCE goldB = 76
ONCE silR = 154     // #9AA7B8 structure
ONCE silG = 167
ONCE silB = 184
ONCE winR = 124     // #7C5CFF windows
ONCE winG = 92
ONCE winB = 255
ONCE txtR = 40      // dark text for the dashboard values
ONCE txtG = 40
ONCE txtB = 40
//--------------------------------------------------------------------//
//=== 1. SILVER BULLET WINDOWS ===
//--------------------------------------------------------------------//
isIntra = GetTimeFrame <= 3600
isWeekday = dayofweek >= 1 AND dayofweek <= 5
inLO = isIntra AND isWeekday AND useLO = 1 AND opentime >= loStart AND opentime < loEnd
inAM = isIntra AND isWeekday AND useAM = 1 AND opentime >= amStart AND opentime < amEnd
inPM = isIntra AND isWeekday AND usePM = 1 AND opentime >= pmStart AND opentime < pmEnd
inWin = inLO OR inAM OR inPM
IF inLO THEN
   winId = 1
ELSIF inAM THEN
   winId = 2
ELSIF inPM THEN
   winId = 3
ELSE
   winId = 0
ENDIF
newWin = inWin AND NOT inWin[1]

atrV = averagetruerange[14](close)

IF showWin = 1 AND inWin THEN
   BACKGROUNDCOLOR(winR, winG, winB, 20)
ENDIF

// Window labels: the last 8 openings
ONCE nWn = 0
IF showWin = 1 AND newWin THEN
   $wnB[nWn] = barindex
   $wnT[nWn] = winId
   $wnY[nWn] = high + 0.9 * atrV
   $wnY2[nWn] = high + 1.8 * atrV
   nWn = nWn + 1
ENDIF
//--------------------------------------------------------------------//
//=== 2. SWING STRUCTURE ===
// Pivot high: strictly above the swingLen bars after it, above or equal to
// the swingLen bars before it (on a tie the most recent bar wins).
//--------------------------------------------------------------------//
ONCE hasPH = 0
ONCE hasPL = 0
ONCE hasPrevPH = 0
ONCE hasPrevPL = 0
ONCE lastPH = 0
ONCE lastPL = 0
ONCE lastPHBar = 0
ONCE lastPLBar = 0
ONCE prevPH = 0
ONCE prevPL = 0

IF barindex >= 2 * swingLen THEN
   IF high[swingLen] > highest[swingLen](high) AND high[swingLen] >= highest[swingLen](high)[swingLen + 1] THEN
      hasPrevPH = hasPH
      prevPH = lastPH
      lastPH = high[swingLen]
      lastPHBar = barindex - swingLen
      hasPH = 1
   ENDIF
   IF low[swingLen] < lowest[swingLen](low) AND low[swingLen] <= lowest[swingLen](low)[swingLen + 1] THEN
      hasPrevPL = hasPL
      prevPL = lastPL
      lastPL = low[swingLen]
      lastPLBar = barindex - swingLen
      hasPL = 1
   ENDIF
ENDIF
//--------------------------------------------------------------------//
//=== 3. BREAK OF STRUCTURE + LEG STRETCHING ===
// A close beyond the last opposite swing starts a new leg. The leg that was
// running becomes a completed setup: it goes to the register exactly as it
// was drawn on the previous bar.
//--------------------------------------------------------------------//
ONCE dir = 0
ONCE legStart = 0
ONCE legStartBar = 0
ONCE legEnd = 0
ONCE legEndBar = 0
ONCE legSweep = 0
ONCE signaled = 0
ONCE legFvgCnt = 0
ONCE nSg = 0

bullShift = dir <> 1 AND hasPH = 1 AND hasPL = 1 AND close > lastPH
bearShift = dir <> 0 - 1 AND hasPH = 1 AND hasPL = 1 AND close < lastPL

IF (bullShift OR bearShift) AND dir <> 0 THEN
   $sgD[nSg] = dir
   $sgS[nSg] = legStart
   $sgSB[nSg] = legStartBar
   $sgE[nSg] = legEnd
   $sgEB[nSg] = legEndBar
   $sgX2[nSg] = barindex - 1 + extendBars
   nSg = nSg + 1
ENDIF

IF bullShift THEN
   dir = 1
   legStart = lastPL
   legStartBar = lastPLBar
   legEnd = high
   legEndBar = barindex
   legSweep = 0
   IF hasPrevPL = 1 AND lastPL < prevPL THEN
      legSweep = 1
   ENDIF
   signaled = 0
   legFvgCnt = 0
ELSIF bearShift THEN
   dir = 0 - 1
   legStart = lastPH
   legStartBar = lastPHBar
   legEnd = low
   legEndBar = barindex
   legSweep = 0
   IF hasPrevPH = 1 AND lastPH > prevPH THEN
      legSweep = 1
   ENDIF
   signaled = 0
   legFvgCnt = 0
ENDIF

IF dir = 1 AND high > legEnd THEN
   legEnd = high
   legEndBar = barindex
   signaled = 0
ENDIF
IF dir = 0 - 1 AND low < legEnd THEN
   legEnd = low
   legEndBar = barindex
   signaled = 0
ENDIF
//--------------------------------------------------------------------//
//=== 4. FAIR VALUE GAPS ===
// Boxes are only ever added; each one keeps the bar where it was mitigated
// ($fgEnd = -1 while it is alive). The mitigation is re-evaluated on the
// live bar every tick, so a touch that does not hold is undone.
//--------------------------------------------------------------------//
rawBullG = 0
rawBearG = 0
IF barindex >= 13 THEN
   IF low > high[2] AND (low - high[2]) >= atrV * fvgMinAtr THEN
      rawBullG = 1
   ENDIF
   IF high < low[2] AND (low[2] - high) >= atrV * fvgMinAtr THEN
      rawBearG = 1
   ENDIF
ENDIF

IF inWin THEN
   IF dir = 1 AND rawBullG = 1 THEN
      legFvgCnt = legFvgCnt + 1
   ENDIF
   IF dir = 0 - 1 AND rawBearG = 1 THEN
      legFvgCnt = legFvgCnt + 1
   ENDIF
ENDIF

ONCE nFg = 0
IF showFvg = 1 AND (rawBullG = 1 OR rawBearG = 1) AND (fvgWinOnly = 0 OR inWin) THEN
   $fgB[nFg] = barindex
   IF rawBullG = 1 THEN
      $fgT[nFg] = low
      $fgBo[nFg] = high[2]
      $fgD[nFg] = 1
   ELSE
      $fgT[nFg] = low[2]
      $fgBo[nFg] = high
      $fgD[nFg] = 0 - 1
   ENDIF
   $fgEnd[nFg] = 0 - 1
   nFg = nFg + 1
ENDIF

IF nFg > 0 THEN
   FOR i = max(0, nFg - fvgKeep) TO nFg - 1 DO
      IF $fgEnd[i] = 0 - 1 OR $fgEnd[i] >= barindex THEN
         gone = 0
         IF $fgD[i] = 1 AND low <= $fgBo[i] THEN
            gone = 1
         ELSIF $fgD[i] = 0 - 1 AND high >= $fgT[i] THEN
            gone = 1
         ENDIF
         IF gone = 1 AND $fgB[i] < barindex THEN
            $fgEnd[i] = barindex
         ELSE
            $fgEnd[i] = 0 - 1
         ENDIF
      ENDIF
   NEXT
ENDIF
//--------------------------------------------------------------------//
//=== 5. ENTRY ZONE AND SIGNAL ===
// Fibonacci price of ratio r on the active leg: legEnd - dir * range * r.
//--------------------------------------------------------------------//
legRng = abs(legEnd - legStart)
zA = legEnd - dir * legRng * 0.618
zB = legEnd - dir * legRng * 0.79
zoneHi = max(zA, zB)
zoneLo = min(zA, zB)
IF dir <> 0 AND legRng > 0 THEN
   retr = dir * (legEnd - close) / legRng
ELSE
   retr = 0
ENDIF

inWinOK = reqWin = 0 OR inWin
fvgOK = reqFvg = 0 OR legFvgCnt > 0

tapBull = dir = 1 AND low <= zoneHi AND close >= zoneLo
tapBear = dir = 0 - 1 AND high >= zoneLo AND close <= zoneHi

sigBull = signaled = 0 AND tapBull AND inWinOK AND fvgOK
sigBear = signaled = 0 AND tapBear AND inWinOK AND fvgOK

score = 1 + inWin + (legFvgCnt > 0) + legSweep
//--------------------------------------------------------------------//
//=== 6. TRADE PLANS ===
//--------------------------------------------------------------------//
ONCE nTd = 0
IF sigBull OR sigBear THEN
   signaled = 1
   $tdB[nTd] = barindex
   $tdE[nTd] = close
   $tdG[nTd] = score
   $tdT1[nTd] = legEnd - dir * legRng * tp1R
   $tdT2[nTd] = legEnd - dir * legRng * tp2R
   IF sigBull THEN
      $tdD[nTd] = 1
      $tdS[nTd] = min(legStart, low) - atrV * slBuf
      $tdY[nTd] = low - 0.7 * atrV
   ELSE
      $tdD[nTd] = 0 - 1
      $tdS[nTd] = max(legStart, high) + atrV * slBuf
      $tdY[nTd] = high + 0.7 * atrV
   ENDIF
   nTd = nTd + 1
ENDIF
//--------------------------------------------------------------------//
//=== 7. DRAWING ===
//--------------------------------------------------------------------//
IF islastbarupdate THEN

   // --- Fibonacci grids: the last keepSetups completed setups + the live one
   sgFirst = max(0, nSg - keepSetups)
   FOR q = sgFirst TO nSg DO
      drawIt = 0
      IF q < nSg THEN
         gD = $sgD[q]
         gS = $sgS[q]
         gSB = $sgSB[q]
         gE = $sgE[q]
         gEB = $sgEB[q]
         gX2 = $sgX2[q]
         drawIt = 1
      ELSIF dir <> 0 THEN
         gD = dir
         gS = legStart
         gSB = legStartBar
         gE = legEnd
         gEB = legEndBar
         gX2 = barindex + extendBars
         drawIt = 1
      ENDIF
      IF drawIt = 1 THEN
         gRng = abs(gE - gS)
         f50 = gE - gD * gRng * 0.5
         f618 = gE - gD * gRng * 0.618
         f661 = gE - gD * gRng * 0.661
         f705 = gE - gD * gRng * 0.705
         f748 = gE - gD * gRng * 0.748
         f79 = gE - gD * gRng * 0.79
         fT1 = gE - gD * gRng * tp1R
         fT2 = gE - gD * gRng * tp2R
         IF gD = 1 THEN
            bR = bullR
            bG = bullG
            bB = bullB
         ELSE
            bR = bearR
            bG = bearG
            bB = bearB
         ENDIF
         // leg connector
         DRAWSEGMENT(gSB, gS, gEB, gE) COLOURED(silR, silG, silB, 166) STYLE(dottedline2, 1)
         IF showFib = 1 THEN
            DRAWSEGMENT(gEB, gE, gX2, gE) COLOURED(bR, bG, bB, 204) STYLE(line, 2)
            DRAWSEGMENT(gSB, gS, gX2, gS) COLOURED(silR, silG, silB, 140) STYLE(line, 1)
            DRAWTEXT("1.0 Origin", gX2 + 5, gS, dialog, standard, 9) COLOURED(silR, silG, silB, 178)
            IF showEq = 1 THEN
               DRAWSEGMENT(gEB, f50, gX2, f50) COLOURED(silR, silG, silB, 128) STYLE(dottedline2, 1)
               DRAWTEXT("0.5 Equilibrium", gX2 + 8, f50, dialog, standard, 9) COLOURED(silR, silG, silB, 191)
            ENDIF
            DRAWSEGMENT(gEB, f618, gX2, f618) COLOURED(bR, bG, bB, 153) STYLE(line, 1)
            DRAWSEGMENT(gEB, f79, gX2, f79) COLOURED(bR, bG, bB, 153) STYLE(line, 1)
            DRAWSEGMENT(gEB, f705, gX2, f705) COLOURED(goldR, goldG, goldB, 230) STYLE(dottedline, 2)
            DRAWTEXT("0.705 Sweet Spot", gX2 + 9, f705, dialog, bold, 10) COLOURED(goldR, goldG, goldB, 255)
            IF showTgt = 1 THEN
               DRAWSEGMENT(gEB, fT1, gX2, fT1) COLOURED(bR, bG, bB, 140) STYLE(dottedline2, 1)
               DRAWSEGMENT(gEB, fT2, gX2, fT2) COLOURED(bR, bG, bB, 102) STYLE(dottedline, 1)
               DRAWTEXT("Target One", gX2 + 5, fT1, dialog, standard, 9) COLOURED(bR, bG, bB, 191)
               DRAWTEXT("Target Two", gX2 + 5, fT2, dialog, standard, 9) COLOURED(bR, bG, bB, 166)
            ENDIF
         ENDIF
         IF showZone = 1 THEN
            // gradient that intensifies toward the 0.705 sweet spot
            DRAWRECTANGLE(gEB, f618, gX2, f661) COLOURED(bR, bG, bB, 0) FILLCOLOR(bR, bG, bB, 31)
            DRAWRECTANGLE(gEB, f661, gX2, f705) COLOURED(bR, bG, bB, 0) FILLCOLOR(bR, bG, bB, 56)
            DRAWRECTANGLE(gEB, f705, gX2, f748) COLOURED(bR, bG, bB, 0) FILLCOLOR(bR, bG, bB, 56)
            DRAWRECTANGLE(gEB, f748, gX2, f79) COLOURED(bR, bG, bB, 0) FILLCOLOR(bR, bG, bB, 31)
         ENDIF
      ENDIF
   NEXT

   // --- Fair value gaps: the last fvgKeep
   IF nFg > 0 THEN
      FOR i = max(0, nFg - fvgKeep) TO nFg - 1 DO
         fgX1 = $fgB[i] - 2
         fgTop = $fgT[i]
         fgBot = $fgBo[i]
         IF $fgEnd[i] = 0 - 1 THEN
            fgX2 = barindex + 2
            IF $fgD[i] = 1 THEN
               DRAWRECTANGLE(fgX1, fgTop, fgX2, fgBot) COLOURED(bullR, bullG, bullB, 115) FILLCOLOR(bullR, bullG, bullB, 46)
            ELSE
               DRAWRECTANGLE(fgX1, fgTop, fgX2, fgBot) COLOURED(bearR, bearG, bearB, 115) FILLCOLOR(bearR, bearG, bearB, 46)
            ENDIF
         ELSE
            // mitigated: frozen where it was last extended, in grey
            fgX2 = $fgEnd[i] + 1
            DRAWRECTANGLE(fgX1, fgTop, fgX2, fgBot) COLOURED(silR, silG, silB, 38) FILLCOLOR(silR, silG, silB, 15)
         ENDIF
      NEXT
   ENDIF

   // --- Trade plans: the last keepTrades
   IF nTd > 0 THEN
      FOR i = max(0, nTd - keepTrades) TO nTd - 1 DO
         tdX1 = $tdB[i]
         tdX2 = $tdB[i] + extendBars
         vEnt = $tdE[i]
         vStp = $tdS[i]
         vT1 = $tdT1[i]
         vT2 = $tdT2[i]
         vMk = $tdY[i]
         vGr = $tdG[i]
         DRAWSEGMENT(tdX1, vEnt, tdX2, vEnt) COLOURED(silR, silG, silB, 204) STYLE(line, 1)
         DRAWSEGMENT(tdX1, vStp, tdX2, vStp) COLOURED(bearR, bearG, bearB, 191) STYLE(dottedline2, 1)
         DRAWSEGMENT(tdX1, vT1, tdX2, vT1) COLOURED(bullR, bullG, bullB, 191) STYLE(dottedline2, 1)
         DRAWSEGMENT(tdX1, vT2, tdX2, vT2) COLOURED(bullR, bullG, bullB, 153) STYLE(dottedline, 1)
         DRAWTEXT("Entry #vEnt#", tdX2 + 8, vEnt, dialog, standard, 10) COLOURED(silR, silG, silB, 255)
         DRAWTEXT("Stop #vStp#", tdX2 + 8, vStp, dialog, standard, 10) COLOURED(bearR, bearG, bearB, 255)
         DRAWTEXT("Target One #vT1#", tdX2 + 10, vT1, dialog, standard, 10) COLOURED(bullR, bullG, bullB, 255)
         DRAWTEXT("Target Two #vT2#", tdX2 + 10, vT2, dialog, standard, 10) COLOURED(bullR, bullG, bullB, 204)
         IF $tdD[i] = 1 THEN
            IF vGr >= 4 THEN
               DRAWTEXT("▲ Optimal Trade Entry · Grade A+", tdX1, vMk, dialog, bold, 10) COLOURED(bullR, bullG, bullB, 255)
            ELSIF vGr = 3 THEN
               DRAWTEXT("▲ Optimal Trade Entry · Grade A", tdX1, vMk, dialog, bold, 10) COLOURED(bullR, bullG, bullB, 255)
            ELSIF vGr = 2 THEN
               DRAWTEXT("▲ Optimal Trade Entry · Grade B", tdX1, vMk, dialog, bold, 10) COLOURED(bullR, bullG, bullB, 255)
            ELSE
               DRAWTEXT("▲ Optimal Trade Entry · Grade C", tdX1, vMk, dialog, bold, 10) COLOURED(bullR, bullG, bullB, 255)
            ENDIF
         ELSE
            IF vGr >= 4 THEN
               DRAWTEXT("▼ Optimal Trade Entry · Grade A+", tdX1, vMk, dialog, bold, 10) COLOURED(bearR, bearG, bearB, 255)
            ELSIF vGr = 3 THEN
               DRAWTEXT("▼ Optimal Trade Entry · Grade A", tdX1, vMk, dialog, bold, 10) COLOURED(bearR, bearG, bearB, 255)
            ELSIF vGr = 2 THEN
               DRAWTEXT("▼ Optimal Trade Entry · Grade B", tdX1, vMk, dialog, bold, 10) COLOURED(bearR, bearG, bearB, 255)
            ELSE
               DRAWTEXT("▼ Optimal Trade Entry · Grade C", tdX1, vMk, dialog, bold, 10) COLOURED(bearR, bearG, bearB, 255)
            ENDIF
         ENDIF
      NEXT
   ENDIF

   // --- Window labels: the last 8
   IF nWn > 0 THEN
      FOR i = max(0, nWn - 8) TO nWn - 1 DO
         wX = $wnB[i]
         wY1 = $wnY[i]
         wY2 = $wnY2[i]
         IF $wnT[i] = 1 THEN
            DRAWTEXT("London Open", wX, wY2, dialog, bold, 9) COLOURED(winR, winG, winB, 255)
         ELSIF $wnT[i] = 2 THEN
            DRAWTEXT("Morning Session", wX, wY2, dialog, bold, 9) COLOURED(winR, winG, winB, 255)
         ELSE
            DRAWTEXT("Afternoon Session", wX, wY2, dialog, bold, 9) COLOURED(winR, winG, winB, 255)
         ENDIF
         DRAWTEXT("Silver Bullet", wX, wY1, dialog, standard, 9) COLOURED(winR, winG, winB, 255)
      NEXT
   ENDIF

   // --- Dashboard
   IF showDash = 1 THEN
      dashCol = 120
      DRAWTEXT("Setup Monitor", dashX, dashY, sansserif, bold, 11) COLOURED(goldR, goldG, goldB) ANCHOR(topright, xshift, yshift)
      IF dir = 0 THEN
         DRAWTEXT("-", dashX + dashCol, dashY, sansserif, bold, 11) COLOURED(goldR, goldG, goldB) ANCHOR(topright, xshift, yshift)
      ELSIF score >= 4 THEN
         DRAWTEXT("Grade A+", dashX + dashCol, dashY, sansserif, bold, 11) COLOURED(goldR, goldG, goldB) ANCHOR(topright, xshift, yshift)
      ELSIF score = 3 THEN
         DRAWTEXT("Grade A", dashX + dashCol, dashY, sansserif, bold, 11) COLOURED(goldR, goldG, goldB) ANCHOR(topright, xshift, yshift)
      ELSIF score = 2 THEN
         DRAWTEXT("Grade B", dashX + dashCol, dashY, sansserif, bold, 11) COLOURED(goldR, goldG, goldB) ANCHOR(topright, xshift, yshift)
      ELSE
         DRAWTEXT("Grade C", dashX + dashCol, dashY, sansserif, bold, 11) COLOURED(goldR, goldG, goldB) ANCHOR(topright, xshift, yshift)
      ENDIF

      DRAWTEXT("Directional Bias", dashX, dashY - 18, sansserif, standard, 10) COLOURED(90, 90, 90) ANCHOR(topright, xshift, yshift)
      IF dir = 1 THEN
         DRAWTEXT("Bullish", dashX + dashCol, dashY - 18, sansserif, bold, 10) COLOURED(bullR, bullG, bullB) ANCHOR(topright, xshift, yshift)
      ELSIF dir = 0 - 1 THEN
         DRAWTEXT("Bearish", dashX + dashCol, dashY - 18, sansserif, bold, 10) COLOURED(bearR, bearG, bearB) ANCHOR(topright, xshift, yshift)
      ELSE
         DRAWTEXT("Forming", dashX + dashCol, dashY - 18, sansserif, bold, 10) COLOURED(silR, silG, silB) ANCHOR(topright, xshift, yshift)
      ENDIF

      DRAWTEXT("Retracement", dashX, dashY - 36, sansserif, standard, 10) COLOURED(90, 90, 90) ANCHOR(topright, xshift, yshift)
      IF dir <> 0 AND legRng > 0 THEN
         retrP = round(retr * 1000) / 10
         DRAWTEXT("#retrP# %", dashX + dashCol, dashY - 36, sansserif, bold, 10) COLOURED(txtR, txtG, txtB) ANCHOR(topright, xshift, yshift)
      ELSE
         DRAWTEXT("-", dashX + dashCol, dashY - 36, sansserif, bold, 10) COLOURED(txtR, txtG, txtB) ANCHOR(topright, xshift, yshift)
      ENDIF

      DRAWTEXT("Entry Zone", dashX, dashY - 54, sansserif, standard, 10) COLOURED(90, 90, 90) ANCHOR(topright, xshift, yshift)
      IF dir = 0 THEN
         DRAWTEXT("-", dashX + dashCol, dashY - 54, sansserif, bold, 10) COLOURED(txtR, txtG, txtB) ANCHOR(topright, xshift, yshift)
      ELSIF close >= zoneLo AND close <= zoneHi THEN
         DRAWTEXT("Inside Zone", dashX + dashCol, dashY - 54, sansserif, bold, 10) COLOURED(goldR, goldG, goldB) ANCHOR(topright, xshift, yshift)
      ELSIF (dir = 1 AND close > zoneHi) OR (dir = 0 - 1 AND close < zoneLo) THEN
         DRAWTEXT("Awaiting Pullback", dashX + dashCol, dashY - 54, sansserif, bold, 10) COLOURED(txtR, txtG, txtB) ANCHOR(topright, xshift, yshift)
      ELSE
         DRAWTEXT("Beyond Zone", dashX + dashCol, dashY - 54, sansserif, bold, 10) COLOURED(txtR, txtG, txtB) ANCHOR(topright, xshift, yshift)
      ENDIF

      DRAWTEXT("Sweet Spot", dashX, dashY - 72, sansserif, standard, 10) COLOURED(90, 90, 90) ANCHOR(topright, xshift, yshift)
      IF dir <> 0 THEN
         sweetP = legEnd - dir * legRng * 0.705
         DRAWTEXT("#sweetP#", dashX + dashCol, dashY - 72, sansserif, bold, 10) COLOURED(txtR, txtG, txtB) ANCHOR(topright, xshift, yshift)
      ELSE
         DRAWTEXT("-", dashX + dashCol, dashY - 72, sansserif, bold, 10) COLOURED(txtR, txtG, txtB) ANCHOR(topright, xshift, yshift)
      ENDIF

      DRAWTEXT("Silver Bullet Window", dashX, dashY - 90, sansserif, standard, 10) COLOURED(90, 90, 90) ANCHOR(topright, xshift, yshift)
      IF NOT isIntra THEN
         DRAWTEXT("Intraday Only", dashX + dashCol, dashY - 90, sansserif, bold, 10) COLOURED(txtR, txtG, txtB) ANCHOR(topright, xshift, yshift)
      ELSIF winId = 1 THEN
         DRAWTEXT("London Open", dashX + dashCol, dashY - 90, sansserif, bold, 10) COLOURED(winR, winG, winB) ANCHOR(topright, xshift, yshift)
      ELSIF winId = 2 THEN
         DRAWTEXT("Morning Session", dashX + dashCol, dashY - 90, sansserif, bold, 10) COLOURED(winR, winG, winB) ANCHOR(topright, xshift, yshift)
      ELSIF winId = 3 THEN
         DRAWTEXT("Afternoon Session", dashX + dashCol, dashY - 90, sansserif, bold, 10) COLOURED(winR, winG, winB) ANCHOR(topright, xshift, yshift)
      ELSE
         DRAWTEXT("Closed", dashX + dashCol, dashY - 90, sansserif, bold, 10) COLOURED(txtR, txtG, txtB) ANCHOR(topright, xshift, yshift)
      ENDIF

      DRAWTEXT("Gap Confluence", dashX, dashY - 108, sansserif, standard, 10) COLOURED(90, 90, 90) ANCHOR(topright, xshift, yshift)
      DRAWTEXT("#legFvgCnt#", dashX + dashCol, dashY - 108, sansserif, bold, 10) COLOURED(txtR, txtG, txtB) ANCHOR(topright, xshift, yshift)

      DRAWTEXT("Liquidity Sweep", dashX, dashY - 126, sansserif, standard, 10) COLOURED(90, 90, 90) ANCHOR(topright, xshift, yshift)
      IF legSweep = 1 THEN
         DRAWTEXT("Swept", dashX + dashCol, dashY - 126, sansserif, bold, 10) COLOURED(bullR, bullG, bullB) ANCHOR(topright, xshift, yshift)
      ELSE
         DRAWTEXT("None", dashX + dashCol, dashY - 126, sansserif, bold, 10) COLOURED(txtR, txtG, txtB) ANCHOR(topright, xshift, yshift)
      ENDIF
   ENDIF
ENDIF

RETURN

Original author: Quantum-Algo, published open source

Download
Filename: PRC_OTE-Silver-Bullet.itf
Downloads: 9
Iván González
Iván González Legend
This author is like an anonymous function, present but not directly identifiable. More details on this code architect as soon as they exit 'incognito' mode.
Author’s Profile

Comments

ProRealCode ProRealCode
Loading...