Gold Desk — Aug 18, 2026: Pinned to Pivot as Real Yields Nudge Higher
Gold sits at $4,394 into the Asia handover, ratcheting inside a tight $4,365–$4,430 session cage with the daily pivot at $4,402.71 acting as the magnet. Real yields ticked +3 bp to 2.44% — a mechanical headwind — but DXY is on the back foot and Fed hike odds keep leaking, so the tape refuses to break. The daily trend is still convincingly bull (RSI 63.9, price sitting +$98 over EMA20), while 15m/1h have rolled beneath their short EMAs. That is a compression, not a top. Bias into London: **fade strength into $4,413–$4,430, buy the golden pocket at $4,360–$4,374**, and let a close either side of the weekly pivot pick the direction.
Gold sits at $4,394 into the Asia handover, ratcheting inside a tight $4,365–$4,430 session cage with the daily pivot at $4,402.71 acting as the magnet. Real yields ticked +3 bp to 2.44% — a mechanical headwind — but DXY is on the back foot and Fed hike odds keep leaking, so the tape refuses to break. The daily trend is still convincingly bull (RSI 63.9, price sitting +$98 over EMA20), while 15m/1h have rolled beneath their short EMAs. That is a compression, not a top. Bias into London: fade strength into $4,413–$4,430, buy the golden pocket at $4,360–$4,374, and let a close either side of the weekly pivot pick the direction.
The session
Spot printed a session low of $4,365.54 and a high of $4,430.88 before mean-reverting into the daily pivot at $4,402.71 — a textbook pivot magnet after Monday's expansion candle. The tape is compressing rather than distributing: the 4h RSI is at 58 with price sitting +$2.7 above EMA20, but the 1h has slipped under EMA20 ($4,402) and EMA50 ($4,395), with MACD histogram rolling negative (-3.37). In plain terms, intraday momentum is fading while the higher timeframes still lean bid.
The catalyst mix supports the ambivalence. Investing.com's own wire is running the headlines "Gold rises near $4,450 as Fed hike bets fade, dollar weakens" alongside "Gold stalls near $4,509 resistance as MACD turns bearish." Both are in the brief; both are true. The market has priced most of the "dovish-vs.-status-quo" tension and now wants a new data point.
COMEX (GC=F) is trading at $4,450.10 — a +1.27% premium to spot PAXG. That's a healthy futures basis, consistent with paper demand still leading physical, and it caps how bearish you can reasonably be while the front-month keeps that mark-up.
Multi-timeframe read
- Daily: Unambiguous bull. RSI 63.9, MACD hist positive though rolling (7.62 ↓), price $98 above EMA20 and $166 above EMA50, and — importantly — $47 above EMA200. Nothing here calls a top.
- 4h: Neutral-bull. RSI 58, price hugging EMA20 from above, MACD hist ticking down. This is the timeframe that will resolve the range.
- 1h: Bearish tilt. RSI 46.5, MACD hist -3.37 turning down, price under both EMA20 and EMA50 (which are effectively pinched at $4,395–$4,402). A momentum bear-flag.
- 15m: Neutral-bear, but hist ticking up — the classic "sold enough for now" print. Price is $2.7 under EMA20, $8.1 under EMA50.
The disagreement is not chaos: it's a higher-timeframe uptrend absorbing a lower-timeframe pullback into the daily pivot. This is the location where either the pullback is done (buy the pocket) or the daily trend gets its first serious test (fade the retest).
Note the second opinion: investing.com's automated daily aggregate flags "Strong Buy", while its moving-averages summary shows 5 buy / 7 sell. That internal split matches my read — trend intact, momentum tired.
Macro frame
Lead with what actually drives the ounce: the US 10y REAL yield sits at 2.44%, up 3 bp day-over-day. Real yields are the mechanical opportunity cost of holding a zero-coupon asset, and every basis point up is a marginal headwind. 10y breakeven inflation is at 2.28% (+1 bp), so the nominal 10y at 4.72% (+4 bp) is being driven primarily by real, not by inflation expectations. That's the hawkish tell — but it's the only hawkish tell today.
The Fed path is the counterweight. Fed-funds futures price 0% cut, 66% hold, 34% HIKE at the Sep 16 FOMC with current target at 3.75%. No cuts on the near screen — but the news wire's dominant note is "Fed hike bets fade," which is why DXY is bleeding despite yields firming. If that hike probability keeps eroding into next week, real yields lose their upward pull and gold's headwind evaporates.
DXY sits at 99.64, -0.15% intraday, -0.17% on the week, -1.10% on the month, and looks heavy: daily RSI 38.6, price below EMA20 and EMA50. The 30-day XAU↔DXY return correlation is -0.27 — weak but consistent with the classic anti-correlation. A DXY breakdown through the 99-handle would be a direct gold tailwind.
Cross-asset:
- VIX 14.25 — risk-on tone, no equity fear bid propping gold.
- GVZ 23.92 — implied vol on gold is moderate, not screaming a break-out. Options aren't pricing a violent move either way.
- Gold/silver ratio at 67.4 with silver at $65.19 — silver leading again keeps the precious-metals regime firmly bullish; a rising ratio would be the warning.
- WTI $85.03, +0.6% — inflation proxy still bid, supporting the breakeven story.
- BTC $64,160, +2.1% — "digital gold" is participating, no cross-asset flight into or out of gold specifically.
North of the border, Canada's CPI printed hot (0.5% m/m vs 0.4% expected; median 2.0% y/y), keeping the BoC hold-and-wait bias intact. Not directly a USD driver, but it reinforces the "sticky inflation, no cuts" theme that's currently keeping real yields where they are.
Two scenarios
Conviction is a qualitative desk read, not a back-tested probability.
Sell setup — fade the range top
- Trigger: 15m/1h close BACK BELOW $4,413 after a poke into $4,413–$4,430.88 (session high / daily R1 zone at $4,439.88). Bonus if RSI on 1h fails to reclaim 55.
- Invalidation: hourly close above $4,440 (daily R1). Above there, R2 at $4,460 opens and this trade is dead.
- Target: $4,382 (daily S1) first, $4,377 (weekly pivot) second — take the bulk there.
- Conviction: 55%
- Rationale: 1h and 15m are under their EMAs, MACD is rolling on 1h and 4h, and price has already tested $4,430 and rejected. The daily uptrend caps how far this can travel, hence the modest target.
Buy setup — golden-pocket reclaim
- Trigger: dip into $4,360–$4,374 (0.5–0.618 retracement of the 5-session $4,316.28–$4,430.88 swing) with a 1h close BACK ABOVE $4,377 (weekly pivot).
- Invalidation: hourly close under $4,345 (daily S2 / weekly-pivot air-pocket). Below there the daily trend is on notice.
- Target: $4,413 first, $4,439 (daily R1) second.
- Conviction: 60%
- Rationale: This is buying the higher-timeframe uptrend at confluence — golden pocket + weekly pivot + prior session lows. The daily EMA20 at $4,296 remains the ultimate line; anything above it and dips are for buying.
Levels worth marking
- Overhead: $4,413 (session compression high), $4,439.88 (daily R1), $4,450 (GC=F front-month, sentiment marker), $4,460 (daily R2), $4,497 (daily R3), $4,509 (investing.com flagged resistance from the wire).
- Pivot cluster: $4,402.71 (daily P) — the magnet — and $4,395–$4,402 EMA20/50 pinch on the 1h.
- Downside: $4,382.34 (daily S1), $4,377.09 (weekly P) — this is the line-in-the-sand for the intraday bull thesis; $4,365.54 (session low), $4,345.17 (daily S2), $4,324.80 (daily S3), $4,311 (weekly S1).
- Trend anchors: daily EMA20 at $4,295.69 is the swing-trend line. Below there, the daily read changes.
Calendar / catalysts
From the pre-fetched ForexFactory block, the only high-impact print on the tape is Canada CPI (Aug 17): headline m/m came in hot at 0.5% (fcst 0.4%), median y/y 2.0% in line, trimmed 1.9% just above 1.8% fcst. Net: mildly hawkish for CAD, no direct XAU/USD read, but reinforces the "sticky inflation" backdrop that has real yields pinned.
The ForexFactory block did not carry a US high-impact event for today in the pre-fetched window — treat the desk as data-light into London, positioning-driven rather than headline-driven. If a US number surfaces mid-session, revert to reactive mode; do not press either side blind.
Sources cited
onewordnews sentiment feed (kitco, dailyfx excerpts), investing.com gold news wire and automated technical aggregate, US Treasury real-yield curve (TIPS 10y at 2.44%), CME fed-funds futures for implied policy path, ForexFactory economic calendar. CFTC COT was unavailable this run — positioning read omitted rather than guessed.
Desk summary & bias
Synthesis: Gold is compressed at the daily pivot after Monday's expansion, with the higher timeframes still trending up and the intraday timeframes rolling. The dominant macro driver — the 10y real yield — nudged +3 bp against gold, but that is more than offset by fading Fed-hike odds, a heavy DXY, and firm cross-asset risk appetite. Technically the tape is a range: fade $4,413–$4,440, buy the $4,360–$4,377 golden pocket / weekly-pivot cluster. The single most important thing to watch next: whether the 34% Fed-hike-probability leaks toward 20% (bullish gold via lower real yields) or firms back toward 45% (bearish).
Trade ideas:
| # | Bias | Setup | Trigger | Entry zone | Invalidation | Target | Conviction | Why |
|---|---|---|---|---|---|---|---|---|
| 1 | SELL | Range-top fade | 15m/1h close back below 4,413 after tag of 4,430–4,440 | 4,413 – 4,440 | 4,440 (close > daily R1) | 4,382 → 4,377 | 55% | 1h/15m under EMAs, MACD rolling, daily R1 confluence |
| 2 | BUY | Golden-pocket reclaim | 1h close back above 4,377 from 4,360–4,374 | 4,360 – 4,377 | 4,345 (close < daily S2) | 4,413 → 4,439 | 60% | Golden pocket + weekly pivot + daily uptrend intact |
| 3 | BUY | Trend continuation (swing) | Daily close > 4,440 with volume | 4,440 – 4,460 | 4,377 (close < weekly P) | 4,497 → 4,509 | 40% | Breakout of compression re-engages daily bull; wire-flagged resistance at 4,509 |
Net desk bias: NEUTRAL with a buy-the-dip lean. Real yields ticked up (headwind) but the entire rest of the macro stack — fading hike odds, weak DXY, low VIX, bid silver, firm crude — argues for tailwinds re-asserting once the intraday flush completes. The daily trend is unbroken and the price sits $98 above EMA20; that's not where you press shorts. I'm weighting technicals over the marginal real-yield move because the yield tick is small, the Fed-odds shift is the more forward-looking signal, and the futures basis (GC +1.27% over spot) is still confirming paper demand. If DXY breaks 99.00 or real yields reverse lower, upgrade the bias to outright BUY.
(not financial advice)
//@version=5
indicator("Gold Desk 2026-08-18 — bias NEUTRAL-BUY", overlay=true, max_lines_count=300, max_labels_count=300, max_boxes_count=100)
// ── User inputs: swing anchors for fib (defaults = 5-session swing in brief) ──
swingLowTime = input.time(timestamp("2026-08-14T00:00:00"), "Swing Low Time")
swingHighTime = input.time(timestamp("2026-08-17T12:00:00"), "Swing High Time")
swingLow = input.float(4316.28, "Swing Low Price")
swingHigh = input.float(4430.88, "Swing High Price")
// ── Session gates (London 07–11 UTC, NY 12–17 UTC) ──
hr = hour(time, "UTC")
inLondon = hr >= 7 and hr < 11
inNY = hr >= 12 and hr < 17
inLiquid = inLondon or inNY
// ── EMAs ──
ema20 = ta.ema(close, 20)
ema50 = ta.ema(close, 50)
ema200 = ta.ema(close, 200)
plot(ema20, "EMA20", color=color.new(color.yellow, 0), linewidth=1)
plot(ema50, "EMA50", color=color.new(color.orange, 0), linewidth=1)
plot(ema200, "EMA200", color=color.new(color.fuchsia, 0), linewidth=2)
// ── Levels from the brief ──
dP = 4402.71
dR1 = 4439.88
dR2 = 4460.25
dR3 = 4497.42
dS1 = 4382.34
dS2 = 4345.17
dS3 = 4324.80
wP = 4377.09
resWire = 4509.00
gcMark = 4450.10
// ── Fibonacci levels from the cited swing ──
fibRange = swingHigh - swingLow
f236 = swingHigh - 0.236 * fibRange
f382 = swingHigh - 0.382 * fibRange
f500 = swingHigh - 0.500 * fibRange
f618 = swingHigh - 0.618 * fibRange
f786 = swingHigh - 0.786 * fibRange
// ── Persistent drawing objects (one-time create, re-position each bar) ──
var line lDP = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.aqua, 0), width=2, style=line.style_solid)
var line lDR1 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.red, 20), width=1, style=line.style_dashed)
var line lDR2 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.red, 40), width=1, style=line.style_dashed)
var line lDR3 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.red, 60), width=1, style=line.style_dotted)
var line lDS1 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.lime, 20), width=1, style=line.style_dashed)
var line lDS2 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.lime, 40), width=1, style=line.style_dashed)
var line lDS3 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.lime, 60), width=1, style=line.style_dotted)
var line lWP = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.orange, 0), width=2, style=line.style_solid)
var line lResW = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.red, 0), width=2, style=line.style_solid)
var line lGC = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.gray, 20), width=1, style=line.style_dotted)
var line lFib236 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.gray, 30), width=1)
var line lFib382 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.gray, 20), width=1)
var line lFib500 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.gray, 10), width=1)
var line lFib618 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.gray, 0), width=1)
var line lFib786 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.gray, 30), width=1)
var box bxGolden = box.new(na, na, na, na, xloc=xloc.bar_time, bgcolor=color.new(color.yellow, 82), border_color=color.new(color.yellow, 40))
var box bxSellZone = box.new(na, na, na, na, xloc=xloc.bar_time, bgcolor=color.new(color.red, 82), border_color=color.new(color.red, 40))
var box bxBuyZone = box.new(na, na, na, na, xloc=xloc.bar_time, bgcolor=color.new(color.lime, 82), border_color=color.new(color.lime, 40))
var box bxBreakZone = box.new(na, na, na, na, xloc=xloc.bar_time, bgcolor=color.new(color.aqua, 88), border_color=color.new(color.aqua, 55))
var line lSellStop = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.red, 0), width=2, style=line.style_solid)
var line lSellTg1 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.red, 30), width=1, style=line.style_dashed)
var line lSellTg2 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.red, 30), width=1, style=line.style_dashed)
var line lBuyStop = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.lime, 0), width=2, style=line.style_solid)
var line lBuyTg1 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.lime, 30), width=1, style=line.style_dashed)
var line lBuyTg2 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.lime, 30), width=1, style=line.style_dashed)
// Labels (right-edge riders)
var label lbDP = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.aqua, 20), textcolor=color.white, size=size.small)
var label lbDR1 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.red, 30), textcolor=color.white, size=size.small)
var label lbDR2 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.red, 45), textcolor=color.white, size=size.small)
var label lbDR3 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.red, 60), textcolor=color.white, size=size.small)
var label lbDS1 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.lime, 30), textcolor=color.black, size=size.small)
var label lbDS2 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.lime, 45), textcolor=color.black, size=size.small)
var label lbDS3 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.lime, 60), textcolor=color.black, size=size.small)
var label lbWP = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.orange, 20), textcolor=color.white, size=size.small)
var label lbResW= label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.red, 0), textcolor=color.white, size=size.small)
var label lbGC = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.gray, 20), textcolor=color.white, size=size.small)
var label lb236 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.gray, 40), textcolor=color.white, size=size.tiny)
var label lb382 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.gray, 30), textcolor=color.white, size=size.tiny)
var label lb500 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.gray, 20), textcolor=color.white, size=size.tiny)
var label lb618 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.gray, 10), textcolor=color.white, size=size.tiny)
var label lb786 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.gray, 40), textcolor=color.white, size=size.tiny)
var label lbSellStop = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.red, 0), textcolor=color.white, size=size.small)
var label lbSellTg1 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.red, 30), textcolor=color.white, size=size.small)
var label lbSellTg2 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.red, 30), textcolor=color.white, size=size.small)
var label lbBuyStop = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.lime, 0), textcolor=color.black, size=size.small)
var label lbBuyTg1 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.lime, 30), textcolor=color.black, size=size.small)
var label lbBuyTg2 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.lime, 30), textcolor=color.black, size=size.small)
// Per-setup state labels
var label stSell = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.red, 0), textcolor=color.white, size=size.normal)
var label stBuy = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.lime, 0), textcolor=color.black, size=size.normal)
var label stSwing = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.aqua, 0), textcolor=color.black, size=size.normal)
// ── State machine (close-confirmed, non-repainting) ──
var string sellState = "ARMED"
var string buyState = "ARMED"
var string swingState = "ARMED"
// Setup 1 — SELL fade
sellTouch = high >= 4413.0
sellConfirm = ta.crossunder(close, 4413.0) and sellTouch and inLiquid
sellInval = close > dR1
sellTg1Hit = close < dS1
sellTg2Hit = close < wP
if barstate.isconfirmed
if sellState == "ARMED" and sellConfirm
sellState := "TRIGGERED"
if sellState == "TRIGGERED" and sellInval
sellState := "INVALIDATED"
if sellState == "TRIGGERED" and sellTg2Hit
sellState := "TARGET HIT"
// Setup 2 — BUY golden-pocket reclaim
buyDipped = low <= f500
buyConfirm = ta.crossover(close, wP) and buyDipped and inLiquid
buyInval = close < dS2
buyTg1Hit = close > 4413.0
buyTg2Hit = close > dR1
if barstate.isconfirmed
if buyState == "ARMED" and buyConfirm
buyState := "TRIGGERED"
if buyState == "TRIGGERED" and buyInval
buyState := "INVALIDATED"
if buyState == "TRIGGERED" and buyTg2Hit
buyState := "TARGET HIT"
// Setup 3 — BUY breakout / swing
swingConfirm = ta.crossover(close, dR1) and inLiquid
swingInval = close < wP
swingTg1Hit = close > dR3
swingTg2Hit = close > resWire
if barstate.isconfirmed
if swingState == "ARMED" and swingConfirm
swingState := "TRIGGERED"
if swingState == "TRIGGERED" and swingInval
swingState := "INVALIDATED"
if swingState == "TRIGGERED" and swingTg2Hit
swingState := "TARGET HIT"
// ── Reposition drawings ONLY on last bar (viewport-anchored) ──
if barstate.islast
lt = chart.left_visible_bar_time
rt = chart.right_visible_bar_time
// Pivot / structural lines
line.set_xy1(lDP, lt, dP)
line.set_xy2(lDP, rt, dP)
line.set_xy1(lDR1, lt, dR1)
line.set_xy2(lDR1, rt, dR1)
line.set_xy1(lDR2, lt, dR2)
line.set_xy2(lDR2, rt, dR2)
line.set_xy1(lDR3, lt, dR3)
line.set_xy2(lDR3, rt, dR3)
line.set_xy1(lDS1, lt, dS1)
line.set_xy2(lDS1, rt, dS1)
line.set_xy1(lDS2, lt, dS2)
line.set_xy2(lDS2, rt, dS2)
line.set_xy1(lDS3, lt, dS3)
line.set_xy2(lDS3, rt, dS3)
line.set_xy1(lWP, lt, wP)
line.set_xy2(lWP, rt, wP)
line.set_xy1(lResW, lt, resWire)
line.set_xy2(lResW, rt, resWire)
line.set_xy1(lGC, lt, gcMark)
line.set_xy2(lGC, rt, gcMark)
// Fibonacci — anchored to swing candles, extends to right edge
line.set_xy1(lFib236, swingHighTime, f236)
line.set_xy2(lFib236, rt, f236)
line.set_xy1(lFib382, swingHighTime, f382)
line.set_xy2(lFib382, rt, f382)
line.set_xy1(lFib500, swingHighTime, f500)
line.set_xy2(lFib500, rt, f500)
line.set_xy1(lFib618, swingHighTime, f618)
line.set_xy2(lFib618, rt, f618)
line.set_xy1(lFib786, swingHighTime, f786)
line.set_xy2(lFib786, rt, f786)
// Golden pocket box (0.5 – 0.618)
box.set_left(bxGolden, swingHighTime)
box.set_right(bxGolden, rt)
box.set_top(bxGolden, f500)
box.set_bottom(bxGolden, f618)
// Trade zones
box.set_left(bxSellZone, lt)
box.set_right(bxSellZone, rt)
box.set_top(bxSellZone, dR1)
box.set_bottom(bxSellZone, 4413.0)
box.set_left(bxBuyZone, lt)
box.set_right(bxBuyZone, rt)
box.set_top(bxBuyZone, wP)
box.set_bottom(bxBuyZone, f618)
box.set_left(bxBreakZone, lt)
box.set_right(bxBreakZone, rt)
box.set_top(bxBreakZone, dR2)
box.set_bottom(bxBreakZone, dR1)
// Trade stop/target lines
line.set_xy1(lSellStop, lt, dR1)
line.set_xy2(lSellStop, rt, dR1)
line.set_xy1(lSellTg1, lt, dS1)
line.set_xy2(lSellTg1, rt, dS1)
line.set_xy1(lSellTg2, lt, wP)
line.set_xy2(lSellTg2, rt, wP)
line.set_xy1(lBuyStop, lt, dS2)
line.set_xy2(lBuyStop, rt, dS2)
line.set_xy1(lBuyTg1, lt, 4413.0)
line.set_xy2(lBuyTg1, rt, 4413.0)
line.set_xy1(lBuyTg2, lt, dR1)
line.set_xy2(lBuyTg2, rt, dR1)
// Labels on the right edge
label.set_x(lbDP, rt)
label.set_y(lbDP, dP)
label.set_text(lbDP, "Daily P 4402.71")
label.set_x(lbDR1, rt)
label.set_y(lbDR1, dR1)
label.set_text(lbDR1, "Daily R1 4439.88")
label.set_x(lbDR2, rt)
label.set_y(lbDR2, dR2)
label.set_text(lbDR2, "Daily R2 4460.25")
label.set_x(lbDR3, rt)
label.set_y(lbDR3, dR3)
label.set_text(lbDR3, "Daily R3 4497.42")
label.set_x(lbDS1, rt)
label.set_y(lbDS1, dS1)
label.set_text(lbDS1, "Daily S1 4382.34")
label.set_x(lbDS2, rt)
label.set_y(lbDS2, dS2)
label.set_text(lbDS2, "Daily S2 4345.17")
label.set_x(lbDS3, rt)
label.set_y(lbDS3, dS3)
label.set_text(lbDS3, "Daily S3 4324.80")
label.set_x(lbWP, rt)
label.set_y(lbWP, wP)
label.set_text(lbWP, "Weekly P 4377.09")
label.set_x(lbResW, rt)
label.set_y(lbResW, resWire)
label.set_text(lbResW, "Wire res 4509 (investing.com)")
label.set_x(lbGC, rt)
label.set_y(lbGC, gcMark)
label.set_text(lbGC, "GC=F front 4450.10")
label.set_x(lb236, rt)
label.set_y(lb236, f236)
label.set_text(lb236, "fib 0.236")
label.set_x(lb382, rt)
label.set_y(lb382, f382)
label.set_text(lb382, "fib 0.382")
label.set_x(lb500, rt)
label.set_y(lb500, f500)
label.set_text(lb500, "fib 0.500")
label.set_x(lb618, rt)
label.set_y(lb618, f618)
label.set_text(lb618, "fib 0.618 (pocket)")
label.set_x(lb786, rt)
label.set_y(lb786, f786)
label.set_text(lb786, "fib 0.786")
label.set_x(lbSellStop, rt)
label.set_y(lbSellStop, dR1)
label.set_text(lbSellStop, "SELL stop 4439.88")
label.set_x(lbSellTg1, rt)
label.set_y(lbSellTg1, dS1)
label.set_text(lbSellTg1, "SELL TP1 4382.34")
label.set_x(lbSellTg2, rt)
label.set_y(lbSellTg2, wP)
label.set_text(lbSellTg2, "SELL TP2 4377.09")
label.set_x(lbBuyStop, rt)
label.set_y(lbBuyStop, dS2)
label.set_text(lbBuyStop, "BUY stop 4345.17")
label.set_x(lbBuyTg1, rt)
label.set_y(lbBuyTg1, 4413.0)
label.set_text(lbBuyTg1, "BUY TP1 4413")
label.set_x(lbBuyTg2, rt)
label.set_y(lbBuyTg2, dR1)
label.set_text(lbBuyTg2, "BUY TP2 4439.88")
label.set_x(stSell, rt)
label.set_y(stSell, 4425.0)
label.set_text(stSell, "SELL fade 55% — " + sellState)
label.set_x(stBuy, rt)
label.set_y(stBuy, f382)
label.set_text(stBuy, "BUY pocket 60% — " + buyState)
label.set_x(stSwing, rt)
label.set_y(stSwing, dR2 + 4.0)
label.set_text(stSwing, "SWING breakout 40% — " + swingState)
// ── Corner status HUD (screen-anchored, this is a HUD not a level) ──
var table hud = table.new(position.top_right, 2, 6, bgcolor=color.new(color.black, 15), border_width=1)
if barstate.islast
table.cell(hud, 0, 0, "Gold Desk 2026-08-18", text_color=color.white, bgcolor=color.new(color.gray, 30))
table.cell(hud, 1, 0, "NEUTRAL-BUY", text_color=color.black, bgcolor=color.new(color.yellow, 0))
table.cell(hud, 0, 1, "10y real", text_color=color.white)
table.cell(hud, 1, 1, "2.44% (+3bp)", text_color=color.red)
table.cell(hud, 0, 2, "DXY", text_color=color.white)
table.cell(hud, 1, 2, "99.64 (-0.15%)", text_color=color.lime)
table.cell(hud, 0, 3, "Fed Sep hike odds", text_color=color.white)
table.cell(hud, 1, 3, "34%", text_color=color.orange)
table.cell(hud, 0, 4, "Daily trend", text_color=color.white)
table.cell(hud, 1, 4, "BULL (RSI 63.9)", text_color=color.lime)
table.cell(hud, 0, 5, "Intraday", text_color=color.white)
table.cell(hud, 1, 5, "COMPRESSED @ pivot", text_color=color.yellow)
// ── Alerts (all close-confirmed, once per bar close) ──
alertcondition(sellConfirm, title="Gold SELL armed — fade 4413/4440", message="XAUUSD tagged 4413–4440 and closed back below 4413 in London/NY — SELL trigger confirmed. Stop 4439.88, targets 4382 → 4377.")
alertcondition(sellInval, title="Gold SELL invalidated — close > 4439.88", message="XAUUSD closed above Daily R1 4439.88 — SELL fade invalidated.")
alertcondition(sellTg2Hit, title="Gold SELL target — 4377 weekly pivot", message="XAUUSD closed below weekly pivot 4377.09 — SELL target reached.")
alertcondition(buyConfirm, title="Gold BUY armed — golden pocket reclaim", message="XAUUSD dipped into 0.5–0.618 pocket and closed back above weekly pivot 4377.09 in London/NY — BUY trigger confirmed. Stop 4345.17, targets 4413 → 4439.88.")
alertcondition(buyInval, title="Gold BUY invalidated — close < 4345.17", message="XAUUSD closed below Daily S2 4345.17 — BUY pocket invalidated.")
alertcondition(buyTg2Hit, title="Gold BUY target — 4439.88 daily R1", message="XAUUSD closed above Daily R1 4439.88 — BUY target reached.")
alertcondition(swingConfirm, title="Gold SWING BUY armed — breakout > 4439.88", message="XAUUSD closed above Daily R1 4439.88 in London/NY — swing breakout trigger confirmed. Stop 4377.09, targets 4497 → 4509.")
alertcondition(swingInval, title="Gold SWING invalidated — close < 4377.09", message="XAUUSD closed below weekly pivot 4377.09 — swing breakout invalidated.")
alertcondition(swingTg2Hit, title="Gold SWING target — 4509 wire resistance", message="XAUUSD closed above 4509 wire-flagged resistance — swing target reached.")
if barstate.isconfirmed and sellConfirm
alert("Gold SELL fade triggered — close back below 4413 after tag of 4413–4440", alert.freq_once_per_bar_close)
if barstate.isconfirmed and buyConfirm
alert("Gold BUY pocket triggered — dip into 0.5–0.618 with close back above weekly P 4377.09", alert.freq_once_per_bar_close)
if barstate.isconfirmed and swingConfirm
alert("Gold SWING breakout triggered — close above Daily R1 4439.88", alert.freq_once_per_bar_close)
{"bias": "NEUTRAL",
"ideas": [
{"bias": "SELL", "label": "Range-top fade", "entry_low": 4413, "entry_high": 4440,
"invalidation": 4440, "target": 4377, "conviction": 55},
{"bias": "BUY", "label": "Golden-pocket reclaim", "entry_low": 4360, "entry_high": 4377,
"invalidation": 4345, "target": 4439, "conviction": 60},
{"bias": "BUY", "label": "Swing breakout", "entry_low": 4440, "entry_high": 4460,
"invalidation": 4377, "target": 4509, "conviction": 40}
]}
TradingView chart script
Paste into TradingView → Pine Editor → Add to chart to see these levels and trade zones drawn live. (Also attached to the email edition as a .pine file.)
//@version=5
indicator("Gold Desk 2026-08-18 — bias NEUTRAL-BUY", overlay=true, max_lines_count=300, max_labels_count=300, max_boxes_count=100)
// ── User inputs: swing anchors for fib (defaults = 5-session swing in brief) ──
swingLowTime = input.time(timestamp("2026-08-14T00:00:00"), "Swing Low Time")
swingHighTime = input.time(timestamp("2026-08-17T12:00:00"), "Swing High Time")
swingLow = input.float(4316.28, "Swing Low Price")
swingHigh = input.float(4430.88, "Swing High Price")
// ── Session gates (London 07–11 UTC, NY 12–17 UTC) ──
hr = hour(time, "UTC")
inLondon = hr >= 7 and hr < 11
inNY = hr >= 12 and hr < 17
inLiquid = inLondon or inNY
// ── EMAs ──
ema20 = ta.ema(close, 20)
ema50 = ta.ema(close, 50)
ema200 = ta.ema(close, 200)
plot(ema20, "EMA20", color=color.new(color.yellow, 0), linewidth=1)
plot(ema50, "EMA50", color=color.new(color.orange, 0), linewidth=1)
plot(ema200, "EMA200", color=color.new(color.fuchsia, 0), linewidth=2)
// ── Levels from the brief ──
dP = 4402.71
dR1 = 4439.88
dR2 = 4460.25
dR3 = 4497.42
dS1 = 4382.34
dS2 = 4345.17
dS3 = 4324.80
wP = 4377.09
resWire = 4509.00
gcMark = 4450.10
// ── Fibonacci levels from the cited swing ──
fibRange = swingHigh - swingLow
f236 = swingHigh - 0.236 * fibRange
f382 = swingHigh - 0.382 * fibRange
f500 = swingHigh - 0.500 * fibRange
f618 = swingHigh - 0.618 * fibRange
f786 = swingHigh - 0.786 * fibRange
// ── Persistent drawing objects (one-time create, re-position each bar) ──
var line lDP = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.aqua, 0), width=2, style=line.style_solid)
var line lDR1 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.red, 20), width=1, style=line.style_dashed)
var line lDR2 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.red, 40), width=1, style=line.style_dashed)
var line lDR3 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.red, 60), width=1, style=line.style_dotted)
var line lDS1 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.lime, 20), width=1, style=line.style_dashed)
var line lDS2 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.lime, 40), width=1, style=line.style_dashed)
var line lDS3 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.lime, 60), width=1, style=line.style_dotted)
var line lWP = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.orange, 0), width=2, style=line.style_solid)
var line lResW = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.red, 0), width=2, style=line.style_solid)
var line lGC = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.gray, 20), width=1, style=line.style_dotted)
var line lFib236 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.gray, 30), width=1)
var line lFib382 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.gray, 20), width=1)
var line lFib500 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.gray, 10), width=1)
var line lFib618 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.gray, 0), width=1)
var line lFib786 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.gray, 30), width=1)
var box bxGolden = box.new(na, na, na, na, xloc=xloc.bar_time, bgcolor=color.new(color.yellow, 82), border_color=color.new(color.yellow, 40))
var box bxSellZone = box.new(na, na, na, na, xloc=xloc.bar_time, bgcolor=color.new(color.red, 82), border_color=color.new(color.red, 40))
var box bxBuyZone = box.new(na, na, na, na, xloc=xloc.bar_time, bgcolor=color.new(color.lime, 82), border_color=color.new(color.lime, 40))
var box bxBreakZone = box.new(na, na, na, na, xloc=xloc.bar_time, bgcolor=color.new(color.aqua, 88), border_color=color.new(color.aqua, 55))
var line lSellStop = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.red, 0), width=2, style=line.style_solid)
var line lSellTg1 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.red, 30), width=1, style=line.style_dashed)
var line lSellTg2 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.red, 30), width=1, style=line.style_dashed)
var line lBuyStop = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.lime, 0), width=2, style=line.style_solid)
var line lBuyTg1 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.lime, 30), width=1, style=line.style_dashed)
var line lBuyTg2 = line.new(na, na, na, na, xloc=xloc.bar_time, color=color.new(color.lime, 30), width=1, style=line.style_dashed)
// Labels (right-edge riders)
var label lbDP = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.aqua, 20), textcolor=color.white, size=size.small)
var label lbDR1 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.red, 30), textcolor=color.white, size=size.small)
var label lbDR2 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.red, 45), textcolor=color.white, size=size.small)
var label lbDR3 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.red, 60), textcolor=color.white, size=size.small)
var label lbDS1 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.lime, 30), textcolor=color.black, size=size.small)
var label lbDS2 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.lime, 45), textcolor=color.black, size=size.small)
var label lbDS3 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.lime, 60), textcolor=color.black, size=size.small)
var label lbWP = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.orange, 20), textcolor=color.white, size=size.small)
var label lbResW= label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.red, 0), textcolor=color.white, size=size.small)
var label lbGC = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.gray, 20), textcolor=color.white, size=size.small)
var label lb236 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.gray, 40), textcolor=color.white, size=size.tiny)
var label lb382 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.gray, 30), textcolor=color.white, size=size.tiny)
var label lb500 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.gray, 20), textcolor=color.white, size=size.tiny)
var label lb618 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.gray, 10), textcolor=color.white, size=size.tiny)
var label lb786 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.gray, 40), textcolor=color.white, size=size.tiny)
var label lbSellStop = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.red, 0), textcolor=color.white, size=size.small)
var label lbSellTg1 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.red, 30), textcolor=color.white, size=size.small)
var label lbSellTg2 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.red, 30), textcolor=color.white, size=size.small)
var label lbBuyStop = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.lime, 0), textcolor=color.black, size=size.small)
var label lbBuyTg1 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.lime, 30), textcolor=color.black, size=size.small)
var label lbBuyTg2 = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.lime, 30), textcolor=color.black, size=size.small)
// Per-setup state labels
var label stSell = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.red, 0), textcolor=color.white, size=size.normal)
var label stBuy = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.lime, 0), textcolor=color.black, size=size.normal)
var label stSwing = label.new(na, na, "", xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.new(color.aqua, 0), textcolor=color.black, size=size.normal)
// ── State machine (close-confirmed, non-repainting) ──
var string sellState = "ARMED"
var string buyState = "ARMED"
var string swingState = "ARMED"
// Setup 1 — SELL fade
sellTouch = high >= 4413.0
sellConfirm = ta.crossunder(close, 4413.0) and sellTouch and inLiquid
sellInval = close > dR1
sellTg1Hit = close < dS1
sellTg2Hit = close < wP
if barstate.isconfirmed
if sellState == "ARMED" and sellConfirm
sellState := "TRIGGERED"
if sellState == "TRIGGERED" and sellInval
sellState := "INVALIDATED"
if sellState == "TRIGGERED" and sellTg2Hit
sellState := "TARGET HIT"
// Setup 2 — BUY golden-pocket reclaim
buyDipped = low <= f500
buyConfirm = ta.crossover(close, wP) and buyDipped and inLiquid
buyInval = close < dS2
buyTg1Hit = close > 4413.0
buyTg2Hit = close > dR1
if barstate.isconfirmed
if buyState == "ARMED" and buyConfirm
buyState := "TRIGGERED"
if buyState == "TRIGGERED" and buyInval
buyState := "INVALIDATED"
if buyState == "TRIGGERED" and buyTg2Hit
buyState := "TARGET HIT"
// Setup 3 — BUY breakout / swing
swingConfirm = ta.crossover(close, dR1) and inLiquid
swingInval = close < wP
swingTg1Hit = close > dR3
swingTg2Hit = close > resWire
if barstate.isconfirmed
if swingState == "ARMED" and swingConfirm
swingState := "TRIGGERED"
if swingState == "TRIGGERED" and swingInval
swingState := "INVALIDATED"
if swingState == "TRIGGERED" and swingTg2Hit
swingState := "TARGET HIT"
// ── Reposition drawings ONLY on last bar (viewport-anchored) ──
if barstate.islast
lt = chart.left_visible_bar_time
rt = chart.right_visible_bar_time
// Pivot / structural lines
line.set_xy1(lDP, lt, dP)
line.set_xy2(lDP, rt, dP)
line.set_xy1(lDR1, lt, dR1)
line.set_xy2(lDR1, rt, dR1)
line.set_xy1(lDR2, lt, dR2)
line.set_xy2(lDR2, rt, dR2)
line.set_xy1(lDR3, lt, dR3)
line.set_xy2(lDR3, rt, dR3)
line.set_xy1(lDS1, lt, dS1)
line.set_xy2(lDS1, rt, dS1)
line.set_xy1(lDS2, lt, dS2)
line.set_xy2(lDS2, rt, dS2)
line.set_xy1(lDS3, lt, dS3)
line.set_xy2(lDS3, rt, dS3)
line.set_xy1(lWP, lt, wP)
line.set_xy2(lWP, rt, wP)
line.set_xy1(lResW, lt, resWire)
line.set_xy2(lResW, rt, resWire)
line.set_xy1(lGC, lt, gcMark)
line.set_xy2(lGC, rt, gcMark)
// Fibonacci — anchored to swing candles, extends to right edge
line.set_xy1(lFib236, swingHighTime, f236)
line.set_xy2(lFib236, rt, f236)
line.set_xy1(lFib382, swingHighTime, f382)
line.set_xy2(lFib382, rt, f382)
line.set_xy1(lFib500, swingHighTime, f500)
line.set_xy2(lFib500, rt, f500)
line.set_xy1(lFib618, swingHighTime, f618)
line.set_xy2(lFib618, rt, f618)
line.set_xy1(lFib786, swingHighTime, f786)
line.set_xy2(lFib786, rt, f786)
// Golden pocket box (0.5 – 0.618)
box.set_left(bxGolden, swingHighTime)
box.set_right(bxGolden, rt)
box.set_top(bxGolden, f500)
box.set_bottom(bxGolden, f618)
// Trade zones
box.set_left(bxSellZone, lt)
box.set_right(bxSellZone, rt)
box.set_top(bxSellZone, dR1)
box.set_bottom(bxSellZone, 4413.0)
box.set_left(bxBuyZone, lt)
box.set_right(bxBuyZone, rt)
box.set_top(bxBuyZone, wP)
box.set_bottom(bxBuyZone, f618)
box.set_left(bxBreakZone, lt)
box.set_right(bxBreakZone, rt)
box.set_top(bxBreakZone, dR2)
box.set_bottom(bxBreakZone, dR1)
// Trade stop/target lines
line.set_xy1(lSellStop, lt, dR1)
line.set_xy2(lSellStop, rt, dR1)
line.set_xy1(lSellTg1, lt, dS1)
line.set_xy2(lSellTg1, rt, dS1)
line.set_xy1(lSellTg2, lt, wP)
line.set_xy2(lSellTg2, rt, wP)
line.set_xy1(lBuyStop, lt, dS2)
line.set_xy2(lBuyStop, rt, dS2)
line.set_xy1(lBuyTg1, lt, 4413.0)
line.set_xy2(lBuyTg1, rt, 4413.0)
line.set_xy1(lBuyTg2, lt, dR1)
line.set_xy2(lBuyTg2, rt, dR1)
// Labels on the right edge
label.set_x(lbDP, rt)
label.set_y(lbDP, dP)
label.set_text(lbDP, "Daily P 4402.71")
label.set_x(lbDR1, rt)
label.set_y(lbDR1, dR1)
label.set_text(lbDR1, "Daily R1 4439.88")
label.set_x(lbDR2, rt)
label.set_y(lbDR2, dR2)
label.set_text(lbDR2, "Daily R2 4460.25")
label.set_x(lbDR3, rt)
label.set_y(lbDR3, dR3)
label.set_text(lbDR3, "Daily R3 4497.42")
label.set_x(lbDS1, rt)
label.set_y(lbDS1, dS1)
label.set_text(lbDS1, "Daily S1 4382.34")
label.set_x(lbDS2, rt)
label.set_y(lbDS2, dS2)
label.set_text(lbDS2, "Daily S2 4345.17")
label.set_x(lbDS3, rt)
label.set_y(lbDS3, dS3)
label.set_text(lbDS3, "Daily S3 4324.80")
label.set_x(lbWP, rt)
label.set_y(lbWP, wP)
label.set_text(lbWP, "Weekly P 4377.09")
label.set_x(lbResW, rt)
label.set_y(lbResW, resWire)
label.set_text(lbResW, "Wire res 4509 (investing.com)")
label.set_x(lbGC, rt)
label.set_y(lbGC, gcMark)
label.set_text(lbGC, "GC=F front 4450.10")
label.set_x(lb236, rt)
label.set_y(lb236, f236)
label.set_text(lb236, "fib 0.236")
label.set_x(lb382, rt)
label.set_y(lb382, f382)
label.set_text(lb382, "fib 0.382")
label.set_x(lb500, rt)
label.set_y(lb500, f500)
label.set_text(lb500, "fib 0.500")
label.set_x(lb618, rt)
label.set_y(lb618, f618)
label.set_text(lb618, "fib 0.618 (pocket)")
label.set_x(lb786, rt)
label.set_y(lb786, f786)
label.set_text(lb786, "fib 0.786")
label.set_x(lbSellStop, rt)
label.set_y(lbSellStop, dR1)
label.set_text(lbSellStop, "SELL stop 4439.88")
label.set_x(lbSellTg1, rt)
label.set_y(lbSellTg1, dS1)
label.set_text(lbSellTg1, "SELL TP1 4382.34")
label.set_x(lbSellTg2, rt)
label.set_y(lbSellTg2, wP)
label.set_text(lbSellTg2, "SELL TP2 4377.09")
label.set_x(lbBuyStop, rt)
label.set_y(lbBuyStop, dS2)
label.set_text(lbBuyStop, "BUY stop 4345.17")
label.set_x(lbBuyTg1, rt)
label.set_y(lbBuyTg1, 4413.0)
label.set_text(lbBuyTg1, "BUY TP1 4413")
label.set_x(lbBuyTg2, rt)
label.set_y(lbBuyTg2, dR1)
label.set_text(lbBuyTg2, "BUY TP2 4439.88")
label.set_x(stSell, rt)
label.set_y(stSell, 4425.0)
label.set_text(stSell, "SELL fade 55% — " + sellState)
label.set_x(stBuy, rt)
label.set_y(stBuy, f382)
label.set_text(stBuy, "BUY pocket 60% — " + buyState)
label.set_x(stSwing, rt)
label.set_y(stSwing, dR2 + 4.0)
label.set_text(stSwing, "SWING breakout 40% — " + swingState)
// ── Corner status HUD (screen-anchored, this is a HUD not a level) ──
var table hud = table.new(position.top_right, 2, 6, bgcolor=color.new(color.black, 15), border_width=1)
if barstate.islast
table.cell(hud, 0, 0, "Gold Desk 2026-08-18", text_color=color.white, bgcolor=color.new(color.gray, 30))
table.cell(hud, 1, 0, "NEUTRAL-BUY", text_color=color.black, bgcolor=color.new(color.yellow, 0))
table.cell(hud, 0, 1, "10y real", text_color=color.white)
table.cell(hud, 1, 1, "2.44% (+3bp)", text_color=color.red)
table.cell(hud, 0, 2, "DXY", text_color=color.white)
table.cell(hud, 1, 2, "99.64 (-0.15%)", text_color=color.lime)
table.cell(hud, 0, 3, "Fed Sep hike odds", text_color=color.white)
table.cell(hud, 1, 3, "34%", text_color=color.orange)
table.cell(hud, 0, 4, "Daily trend", text_color=color.white)
table.cell(hud, 1, 4, "BULL (RSI 63.9)", text_color=color.lime)
table.cell(hud, 0, 5, "Intraday", text_color=color.white)
table.cell(hud, 1, 5, "COMPRESSED @ pivot", text_color=color.yellow)
// ── Alerts (all close-confirmed, once per bar close) ──
alertcondition(sellConfirm, title="Gold SELL armed — fade 4413/4440", message="XAUUSD tagged 4413–4440 and closed back below 4413 in London/NY — SELL trigger confirmed. Stop 4439.88, targets 4382 → 4377.")
alertcondition(sellInval, title="Gold SELL invalidated — close > 4439.88", message="XAUUSD closed above Daily R1 4439.88 — SELL fade invalidated.")
alertcondition(sellTg2Hit, title="Gold SELL target — 4377 weekly pivot", message="XAUUSD closed below weekly pivot 4377.09 — SELL target reached.")
alertcondition(buyConfirm, title="Gold BUY armed — golden pocket reclaim", message="XAUUSD dipped into 0.5–0.618 pocket and closed back above weekly pivot 4377.09 in London/NY — BUY trigger confirmed. Stop 4345.17, targets 4413 → 4439.88.")
alertcondition(buyInval, title="Gold BUY invalidated — close < 4345.17", message="XAUUSD closed below Daily S2 4345.17 — BUY pocket invalidated.")
alertcondition(buyTg2Hit, title="Gold BUY target — 4439.88 daily R1", message="XAUUSD closed above Daily R1 4439.88 — BUY target reached.")
alertcondition(swingConfirm, title="Gold SWING BUY armed — breakout > 4439.88", message="XAUUSD closed above Daily R1 4439.88 in London/NY — swing breakout trigger confirmed. Stop 4377.09, targets 4497 → 4509.")
alertcondition(swingInval, title="Gold SWING invalidated — close < 4377.09", message="XAUUSD closed below weekly pivot 4377.09 — swing breakout invalidated.")
alertcondition(swingTg2Hit, title="Gold SWING target — 4509 wire resistance", message="XAUUSD closed above 4509 wire-flagged resistance — swing target reached.")
if barstate.isconfirmed and sellConfirm
alert("Gold SELL fade triggered — close back below 4413 after tag of 4413–4440", alert.freq_once_per_bar_close)
if barstate.isconfirmed and buyConfirm
alert("Gold BUY pocket triggered — dip into 0.5–0.618 with close back above weekly P 4377.09", alert.freq_once_per_bar_close)
if barstate.isconfirmed and swingConfirm
alert("Gold SWING breakout triggered — close above Daily R1 4439.88", alert.freq_once_per_bar_close)
— the resident
Coiled at the pivot, biased to buy the pocket