Goldbach + PO3 Grid [GBB]Goldbach + PO3 Grid
An open-source visualization of two ICT concepts — the Goldbach dealing-range grid and the daily Power of 3 (PO3) cycle — combined with a transparent confluence signal layer. The Pine source is published as a "Free open-source script" so you can read every line, fork it, audit the math, and confirm the signals are computed exactly as documented.
This is a tool, not a strategy. Use it to make ICT structure visible on your chart at any timeframe, and to flag the moments when a Goldbach level tap aligns with a resolved PO3 bias.
What it draws
Goldbach grid (canonical zone-based implementation).Once an IPDA (Interbank Price Delivery Algorithm — ICT terminology for the n-bar high/low window used as the dealing-range basis) range is established, the script overlays 14 prime-partition lines plus equilibrium and speed-bump references on it. The lines sit at the canonical Goldbach percentages — pairs of primes that sum to 100, per Goldbach's conjecture: 3+97, 11+89, 17+83, 29+71, 41+59, 47+53, plus the trivial 0/100 boundary.
Per ICT teaching, roles are zones between adjacent prime-partition lines, not the lines themselves. The teaching documents the rule explicitly: "To map the levels to an ICT concept, like rejection block, order block, we take the value of the level just below it until the current value." Each zone has a trigger line at its equilibrium-facing edge:
RB (Rejection Block) — zone 0-3 / 97-100, triggers at 3 / 97
OB (Order Block) — zone 3-11 / 89-97, triggers at 11 / 89
FVG (Fair Value Gap) — zone 11-17 / 83-89, triggers at 17 / 83
LV (Liquidity Void) — zone 29-41 / 59-71, triggers at 41 / 59
BRK (Breaker) — zone 41-47 / 53-59, triggers at 47 / 53
EQ (Equilibrium) at 50 — boundary between premium and discount, derived as midpoint between MB pair
EXT — range extremes at 0 / 100
The 17-29 / 71-83 region between FVG and LV has no canonical role name in ICT teaching; the script draws the 29 / 71 lines as neutral boundary markers. Within the LV zone, the script also draws non-prime "speed bump" lines at 35 and 65 — taught by ICT as partial-profit reference points, not as entry triggers. They are visual references only and do not generate signals.
Premium territory (above EQ) is tinted; discount territory (below EQ) is tinted in the inverse color. The grid updates automatically when the underlying IPDA range shifts.
Three range sources are available:
PDA Lookback (default) — highest high and lowest low of the past 60 HTF bars. Computed natively in the chart's timeframe when the lookback fits Pine's max_bars_back budget (1H and above with daily HTF). Falls back to `request.security` on the HTF directly when the native lookback would exceed the budget (e.g., 15m with daily HTF needs 5,760 native bars; the fallback uses 60 daily bars instead). The status table shows which path is active.
HTF Swing — most recent confirmed pivot high and pivot low on a higher timeframe.
Manual— user-set price bounds.
Power of 3 module
The script anchors a daily PO3 cycle at NY midnight, then tracks three phases — Accumulation, Manipulation, Distribution — based on a Judas swing detection (false move beyond a recent extreme) followed by displacement (FVG-confirmed move in the opposite direction). Phase state, Judas direction, and resolved PO3 bias are shown in the on-chart status table. Historical Judas/Distribution markers are rendered for past periods so you can see how the cycle resolved historically.
Signal layer (optional)
When a Goldbach trigger line is tapped and the current PO3 bias agrees with the trade direction implied by that tap (e.g., bearish PO3 + premium tap → short setup), a signal fires. Three presets control which roles qualify:
Strict — OB and FVG triggers only (lines 11 / 17 / 83 / 89). Requires bias resolved + dispMult ≥ 1.5× ATR + HTF bias agreement.
Standard — adds LV and BRK triggers (lines 41 / 47 / 53 / 59). Requires bias resolved. HTF bias filter optional. This is what the backtest below was run on.
Loose — adds RB and MB/EQ triggers (lines 3 / 50 / 97). Requires Manipulation or Distribution phase active. Speed bumps and boundary lines (35/65, 29/71) never trigger.
Signals appear as triangles, a one-line label noting the role and PO3 bias, and a translucent vertical highlight on the firing bar. A 9-condition alert suite covers each signal type for automation.
Settings walkthrough
The settings panel is grouped into modules. Defaults are tuned to match ICT-canonical conventions where they exist; everything else is what we used during backtesting. None of the values below were tuned against our test data, so they're starting points rather than optimized parameters.
Three choices for how the dealing range is determined:
IPDA Lookback (default) — highest high and lowest low over the configured lookback window. Reproducible regardless of how much chart history is loaded. This is what the backtesting was done on.
HTF Swing — uses the most recent confirmed pivot high and pivot low on a higher timeframe. Reactive to recent structure rather than a fixed window. Useful if you trade off explicit swing structure rather than a rolling N-day range.
Manual — you set the high and low yourself. Use when you've already mapped a dealing range and just want the Goldbach grid drawn on it.
HTF Timeframe . The reference timeframe for both IPDA Lookback and HTF Swing. Default `D` (daily). Pick a timeframe higher than your chart timeframe — the indicator does not warn you if you set HTF below chart, but the result is meaningless. For 15m/1H charts, daily is appropriate. For 4H/D charts, weekly may make more sense.
HTF Pivot Length . Used only by HTF Swing. Number of bars left and right needed to confirm a swing pivot on the HTF timeframe. Default 5. Lower values produce more reactive swings but more false swings; higher values produce more stable swings but lag.
IPDA Lookback (bars) . Used only by IPDA Lookback. Number of HTF bars to scan for the highest high and lowest low. ICT canonically teaches three values: 20, 40, and 60. We used 60 for backtesting (60 daily bars ≈ 60 days of price action regardless of chart timeframe). Lower the value for a tighter, more reactive range; raise it for a more stable range that updates less often.
Manual: Range High / Range Low . Used only when Range Source is `Manual`. Numeric prices for the range bounds. Default 0.0 (placeholder); set to your desired values when using the Manual source.
Goldbach Grid
Show Grid / Show Labels / Show Tints. Independently togglable. Show Grid draws the 17 horizontal lines (14 prime-partition lines, EQ at 50, plus speed bumps at 35/65). Show Labels adds the role text (OB_HIGH, FVG_LOW, LV_HIGH, BRK_LOW, RB_HIGH, etc.) at the right edge. Show Tints fills the premium half (above EQ) and discount half (below EQ) with colored overlay boxes.
Invert on Bear. When on, the role labels flip vertically when the underlying range formed bearishly (low after high rather than high after low). The math doesn't change; only the labels swap. Most traders leave this on.
PO3
Enable PO3. Master toggle for the entire daily cycle module. When off, the Goldbach grid still draws but no PO3 detection or signaling happens.
Anchor. When the daily cycle "starts." ICT canon is `Daily NY Midnight` — 00:00 New York time. The other option is `Session: Custom`, which lets you set an arbitrary anchor time for non-equity sessions or alternative trading regimes. For 24/7 crypto, the default works.
Custom Anchor Time. Used only when Anchor is set to `Session: Custom`. HH:MM format in chart timezone.
Accumulation Threshold (× ATR). During the early hours of the daily period, price is considered "still accumulating" if it stays within this multiple of ATR from the open. Default 0.5. Raise it for more permissive accumulation (longer manipulation phase delay); lower it for stricter accumulation.
Displacement Multiplier (× ATR). Required size of the displacement candle that confirms a transition into Distribution phase. Default 1.0. Higher values require more decisive moves to confirm bias; lower values accept smaller candles as confirmation. Strict preset overrides this with 1.5.
Require FVG Confirmation. When on, the displacement step also requires a fair value gap of the correct polarity within the last 3 bars before bias is resolved. Default on. This is a meaningful filter — turning it off roughly doubles signal frequency but reduces signal quality.
Max Historical Periods. Cap on how many past PO3 periods retain their visual markers (J↑/J↓ Judas labels and D Distribution labels) on the chart. Default 50. Lower for cleaner charts; higher to see further back. Old markers are deleted as new ones close.
Signal Layer
Preset. Three confluence configurations:
trict — only OB and FVG triggers qualify (lines at 11/17/83/89). Requires resolved PO3 bias, displacement ≥ 1.5× ATR, and HTF bias agreement. Highest signal-to-noise ratio, lowest signal frequency.
Standard (default) — adds LV and BRK triggers (lines at 41/47/53/59). Requires resolved PO3 bias. HTF bias filter is optional. This is what the backtesting was done on.
Loose — adds RB and MB/EQ triggers (lines at 3/50/97). Requires Manipulation or Distribution phase active. Speed bump levels (35/65) and boundary lines (29/71) are excluded from all presets — they are visual references only.
The presets aren't magic — they're three reasonable points on a precision/recall curve. Strict misses many real setups; Loose generates many false ones. I used Standard as the middle ground.
Require HTF Bias Filter. When on, signals only fire if the higher-timeframe trend (measured by HTF SMA slope) agrees with the signal direction. Always on for Strict, always off for Loose, optional for Standard. Useful in trending markets to avoid counter-trend signals; restrictive in choppy markets.
Signal Cooldown (bars) . Minimum bars between consecutive signals. Default 10. Prevents rapid-fire repeat signals against the same level when price oscillates around it.
Show Signal Labels . When on, every signal gets a verbose one-line label noting the role tapped, the PO3 bias, and the active preset (e.g., "OB_HIGH 89% • Bear • Standard"). When off, only the triangle marker appears.
Highlight Signal Bar. Translucent vertical strip behind the firing bar. Makes signals identifiable at any zoom level. Default on.
Style & Display
Show Period Boxes. Renders historical PO3 period markers (Judas direction labels, distribution markers, period borders). Useful for studying past cycle resolutions.
Show True Open Line. Draws a horizontal line at the daily open price, extended through the day. Reference for premium/discount intraday.
Status Table Position . Where the on-chart status table sits. Default top-right. The table shows current range, EQ price, position percentage, current PO3 phase, and most recent signal — keep it visible.
Status Table Text Size. Self-explanatory. Smaller is less obtrusive but harder to read on high-DPI displays.
Colors. All colors (premium tint, discount tint, level role colors, period borders, signal markers) are configurable per-element. The defaults are designed for dark charts; on light charts you'll likely want to adjust the tints to lower opacity.
Alerts
The script defines 9 named alertconditions, each subscribable separately in TradingView's alert dialog:
Goldbach: EQ tap — price tapped equilibrium (the 50% line)
Goldbach: Premium tap — any tap in the premium half
Goldbach: Discount tap — any tap in the discount half
Goldbach: Sweep — tap of the 0% or 100% extreme
PO3: Manipulation phase entered
PO3: Distribution confirmed bullish
PO3: Distribution confirmed bearish
Signal: Long
Signal: Short
In the alert creation dialog, select this indicator, then pick the specific condition you want. All alerts include `{{ticker}}` and `{{interval}}` placeholders so the message identifies the chart. You can run multiple alerts on the same chart simultaneously (e.g., one for Long signals and one for Distribution-confirmed-bearish).
Notes for first-time use
After adding the indicator to your chart, scroll back to load enough history for the IPDA Lookback computation to populate (typically a few seconds on a fully-loaded chart). The grid will appear once range data is available. The status table on the right shows current range bounds, EQ price, position percentage, current PO3 phase, and most recent signal — use this as a quick health check that the indicator is reading the chart correctly.
If grid lines or labels appear misaligned with price candles, the indicator may be pinned to a separate price scale. The script declares `linktoseries=true` to prevent this, but if you encounter it: right-click the indicator name → Pin to Scale → match the scale your price chart uses.
License & contributions
Source available under TradingView's Free Open-source license. Forks, modifications, and pull requests welcome. We will respond to bug reports in the comments below this publication.
Built by The Good, the Bad and the Bitcoin.
Pine Script® インジケーター





