Gold: Pullback Into the Golden Pocket With the Daily Trend Still Long
Spot gold sits at $4,387.84, mid-range between yesterday's 4,365 low and 4,430 high, with the intraday tape (15m/1h) oversold under a stack of falling EMAs while the daily chart is still comfortably above its 20/50/200 stack. The macro backdrop is contradictory: 10y real yields ground three basis points higher to 2.44%, and fed-funds futures now price a 34% *hike* into the September FOMC with zero cut probability — that is a headwind. Offsetting it, DXY is soft at 99.65 and slipping, and investing.com's automated daily aggregate reads **Strong Buy**. We frame this as a controlled pullback into a well-defined golden pocket rather than a trend break; both a mean-reversion buy and a bounce-fade sell are live, with the buy carrying the higher conviction.
Spot gold sits at $4,387.84, mid-range between yesterday's 4,365 low and 4,430 high, with the intraday tape (15m/1h) oversold under a stack of falling EMAs while the daily chart is still comfortably above its 20/50/200 stack. The macro backdrop is contradictory: 10y real yields ground three basis points higher to 2.44%, and fed-funds futures now price a 34% hike into the September FOMC with zero cut probability — that is a headwind. Offsetting it, DXY is soft at 99.65 and slipping, and investing.com's automated daily aggregate reads Strong Buy. We frame this as a controlled pullback into a well-defined golden pocket rather than a trend break; both a mean-reversion buy and a bounce-fade sell are live, with the buy carrying the higher conviction.
The session
Asia lifted price out of yesterday's 4,365 low and traded it back up to the 4,387 area, but the recovery is fragile: the 15m tape is running RSI 34, MACD histogram is negative and only just curling up, and price sits nine dollars below the 15m EMA20 and fourteen below the 15m EMA50. On the 1h, the picture is similar — RSI 43.5, MACD histogram sharply negative, price under both the 20 and 50 EMAs. So the short-term drift is still offered even after the small overnight bid.
The catalyst set is thin. The onewordnews sweep and investing.com headline reel both flagged the same driver mix — "Gold rises near $4,450 as Fed hike bets fade, dollar weakens" and "Gold stalls near $4,509 resistance as MACD turns bearish: Live levels." Read together they describe exactly the tape we have: a market that ran into distribution near 4,500, backed off, and is now working out whether the pullback is a re-load into the uptrend or the start of a deeper mean-reversion.
Multi-timeframe read
The timeframes disagree, and the disagreement is the trade.
- 15m — RSI 34.1, price below EMA20 (-9) and EMA50 (-15). Oversold, capped by falling short EMAs. Bearish.
- 1h — RSI 43.5, MACD histogram -3.77 and pointing down, price 13.7 below EMA20. Bearish momentum, but not oversold.
- 4h — RSI 56.1, MACD histogram just positive but rolling over, price only $3 under the EMA20. Neutral. This is the fulcrum timeframe.
- 1d — RSI 63.1, price $92 above EMA20, $161 above EMA50, $40 above EMA200. MACD histogram is +7.21 but rolling. Trend still long, momentum decelerating.
The read: intraday sellers are in control, but they are pushing into a daily uptrend that has not been technically broken. That is a classic dip-buy structure — provided the 4h EMA20 (4,390) and the weekly pivot (4,377) hold on a closing basis. Lose those, and the 4h flips bearish and the daily's protective cushion starts to look thinner than $40. Investing.com's automated aggregate reads Strong Buy on the daily; its own moving-average table is actually Sell (5 buy / 7 sell), with RSI and MACD carrying the bullish vote. That split mirrors ours — long-term trend up, near-term momentum negative — so on this one we are aligned.
Macro frame
Lead with real yields. The 10y TIPS closed at 2.44%, up 3 bp d/d. Breakevens ticked up 1 bp to 2.28%, and the nominal 10y is at 4.72%, up 4 bp. Rising real yields are the direct opportunity cost of holding a non-yielding asset — this is the primary gold driver, and the direction is against us.
The reason real yields are grinding higher is visible in the Fed-odds strip. Fed-funds futures price 66% hold, 34% hike, 0% cut into September 16. There is no rate-cut path in the front end — the market is pricing a Fed that is either on hold or forced tighter, at a current 3.75% upper bound. That mix should keep real yields firm and, all else equal, should sit on gold.
What is offsetting it — and it is offsetting it, given price is +9.1% on the month — is the dollar. DXY at 99.65 is -0.14% on the day, -0.16% on the week, -1.09% on the month. Daily RSI 38.8, price under both the EMA20 (100.15) and EMA50 (100.21). The 30-day DXY↔XAU return correlation is -0.27 — modest, but the right sign — and a softer dollar has been enough to blunt the real-yield drag. The cross-asset frame is quiet: VIX 14.25 (calm), gold/silver ratio 67.2 (silver leadership continues, a healthy PM signal), WTI $85 with a small bid, BTC $64k. GVZ (gold implied vol) prints NaN this run, so we cannot cite an implied-vol read — flagging that as a data gap.
Net: the macro is not a green light. It is a market where a softer dollar and residual China/EM bid have kept a lid on the real-yield damage. Any reversal higher in DXY, or a hot US print that lifts real yields another 5–10 bp, is the primary tail risk.
Two scenarios
These are qualitative reads, not back-tested probabilities.
Buy setup — Reclaim of the golden pocket
- Trigger: 1h close back above 4,402.71 (daily pivot) after a tag of the 4,375–4,392 zone (0.382–0.5 fib + weekly pivot + 4h EMA20 confluence).
- Invalidation: 1h close below 4,359.51 (0.618 fib / low of the golden pocket).
- Target: 4,439.88 (daily R1), then extension to 4,460.25 (daily R2).
- Conviction: 55%.
- Rationale: Daily trend intact, price has retraced into the highest-probability re-load zone of the last major swing, DXY is soft, and the investing.com aggregate is Strong Buy. The trigger requires actual reclaim — we are not buying a wick, we want the pivot back on a closing basis.
Sell setup — Fade the pivot
- Trigger: 1h reject at 4,402.71 or 4h close below 4,377 (weekly pivot).
- Invalidation: 1h close above 4,413 (0.236 fib) — closes above the fib flip our thesis.
- Target: 4,345 (daily S2), extension to 4,324 (daily S3) or 4,311 (weekly S1).
- Conviction: 35%.
- Rationale: The 1h and 15m are momentum-bearish under falling EMAs, and rising real yields plus a 34% hike-odds print into September are a genuine headwind. If the golden pocket cannot hold, the next visible bid sits down at the weekly S1 / daily S2 confluence.
Levels worth marking
- Session/near-term supply: 4,430–4,443 (session high + weekly swing high).
- Daily R1 / R2: 4,439.88 / 4,460.25.
- Daily pivot: 4,402.71 — the line that decides bull-vs-bear on the intraday chart.
- Weekly pivot / 0.5 fib cluster: 4,375–4,382 (weekly P 4,377.09, daily S1 4,382.34, 0.5 fib 4,375.44).
- Golden pocket: 4,359.51 – 4,375.44 (0.5–0.618).
- Deeper demand: 4,336 (0.786 fib) → 4,324 (daily S3) → 4,311 (weekly S1).
- Daily EMA20: 4,295 — the last line of daily trend defence.
Calendar / catalysts
From ForexFactory (pre-fetched):
- Mon Aug 17, 15:30 UTC — CAD CPI m/m (actual 0.5% vs 0.4% forecast, prev -0.4%) — already out; hotter-than-expected Canadian print, small CAD/USD spillover only.
- Mon Aug 17 — CAD Median / Trimmed / Common CPI y/y (2.0% / 1.9% / 2.7%) — already out.
- Tue Aug 18, 09:00 UTC — GBP Claimant Count Change (forecast 16.5K vs prev 6.7K) — GBP-specific; matters for gold only via a DXY knock-on.
- Tue Aug 18 — GBP Average Earnings Index 3m/y (forecast 4.0% vs prev 4.3%) — same channel.
No US tier-1 print in the pre-fetched window. That means the tape is likely to be driven by dollar flow and positioning rather than a catalyst, which favours the technical read.
Sources cited
Price + technicals: PAXGUSDT spot, GC=F front-month. Macro rates: Treasury.gov 10y TIPS (2.44%), ^TNX nominal 10y, fed-funds futures. Cross-asset: VIX, WTI, BTC feeds. News: onewordnews sweep (gold/DXY/yields/CPI), investing.com headline reel (specifically "Gold rises near $4,450 as Fed hike bets fade, dollar weakens" and "Gold stalls near $4,509 resistance as MACD turns bearish: Live levels"). Independent technical cross-check: investing.com daily aggregate = Strong Buy. Calendar: ForexFactory. CFTC COT unavailable this run.
Desk summary & bias
Gold is mid-range in a controlled pullback: the daily trend is intact and price has retraced neatly into a 4,375–4,392 confluence (weekly pivot + 0.5 fib + 4h EMA20), while the 15m and 1h read momentum-bearish under falling short EMAs. The dominant macro driver is the 10y TIPS at 2.44% (+3 bp d/d) with a Fed strip that prices 66% hold / 34% hike / 0% cut — a genuine headwind that is being offset by a soft DXY grinding under its EMA20/50. The single most important thing to watch next is a 1h close reclaim (or rejection) of the 4,402.71 daily pivot; that is the line that resolves the timeframe disagreement.
| # | Bias | Setup | Trigger | Entry zone | Invalidation | Target | Conviction | Why |
|---|---|---|---|---|---|---|---|---|
| 1 | BUY | Golden-pocket reclaim | 1h close > 4,402.71 after tag of the pocket | 4,375–4,392 | 4,359.51 (1h close) | 4,439.88 → 4,460.25 | 55% | Daily trend intact + fib/weekly-pivot confluence + soft DXY |
| 2 | SELL | Pivot-rejection fade | 1h reject 4,402.71 or 4h close < 4,377 | 4,395–4,413 | 4,413 (1h close) | 4,345 → 4,324 | 35% | 1h/15m momentum bearish under falling EMAs, real yields +3 bp |
| 3 | BUY | Deep-dip swing | 1h close reclaim of 4,336 after tap | 4,324–4,340 | 4,311 (weekly S1) | 4,402 → 4,440 | 40% | Only lives if pocket fails; buys the deeper weekly-S1 cluster |
Net desk bias: BUY (dip-buy, not chase). We lean long because the daily trend is unbroken, price has retraced into the highest-probability re-load zone of the recent weekly swing, DXY is soft and under its short EMAs, and the investing.com aggregate corroborates. We are weighting the technical structure over the macro because the macro headwind (rising real yields, hawkish Fed strip) has been in force for weeks while spot has still added 9.1% on the month — the market has already digested it. The read flips to neutral on a 1h close under 4,359.51 and turns outright bearish on a daily close under the weekly pivot at 4,377.
(not financial advice)
//@version=5
indicator("Gold Desk 2026-08-18 — bias BUY", overlay=true, max_lines_count=300, max_labels_count=300, max_boxes_count=100)
// ── Inputs / anchors from the desk note ──
swingHi = 4442.95
swingLo = 4307.93
rng = swingHi - swingLo
fib0236 = swingHi - rng * 0.236
fib0382 = swingHi - rng * 0.382
fib0500 = swingHi - rng * 0.500
fib0618 = swingHi - rng * 0.618
fib0786 = swingHi - rng * 0.786
// ── Pivots (from brief) ──
dP = 4402.71
dR1 = 4439.88
dR2 = 4460.25
dS1 = 4382.34
dS2 = 4345.17
dS3 = 4324.80
wP = 4377.09
wS1 = 4311.24
// ── Trade levels (from the trade table) ──
buyEntryLo = 4375.0
buyEntryHi = 4392.0
buyInvalid = 4359.51
buyTarget1 = 4439.88
buyTarget2 = 4460.25
selEntryLo = 4395.0
selEntryHi = 4413.0
selInvalid = 4413.0
selTarget1 = 4345.0
selTarget2 = 4324.0
deepEntryLo = 4324.0
deepEntryHi = 4340.0
deepInvalid = 4311.24
deepTarget = 4402.0
// ── 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)
// ── Fibonacci retracement (full-width, price-anchored) ──
hFibHi = hline(swingHi, "Swing High 4442.95", color=color.new(color.gray, 30), linestyle=hline.style_dotted)
hFib0236 = hline(fib0236, "0.236", color=color.new(color.teal, 40))
hFib0382 = hline(fib0382, "0.382", color=color.new(color.teal, 40))
hFib0500 = hline(fib0500, "0.500 (pocket top)", color=color.new(color.yellow, 20), linestyle=hline.style_dashed)
hFib0618 = hline(fib0618, "0.618 (pocket low)", color=color.new(color.yellow, 20), linestyle=hline.style_dashed)
hFib0786 = hline(fib0786, "0.786", color=color.new(color.teal, 40))
hFibLo = hline(swingLo, "Swing Low 4307.93", color=color.new(color.gray, 30), linestyle=hline.style_dotted)
// ── Golden pocket 0.5–0.618 shaded band ──
fill(hFib0500, hFib0618, color=color.new(color.yellow, 82), title="Golden pocket 0.5–0.618")
// ── Supply zone (session high + weekly swing) 4430–4443 ──
hSupplyHi = hline(4442.95, "Supply top", color=color.new(color.red, 60))
hSupplyLo = hline(4430.00, "Supply bottom", color=color.new(color.red, 60))
fill(hSupplyHi, hSupplyLo, color=color.new(color.red, 82), title="Supply 4430–4443")
// ── Demand zone (weekly-S1 cluster) 4311–4324 ──
hDemHi = hline(4324.80, "Demand top", color=color.new(color.green, 60))
hDemLo = hline(4311.24, "Demand bottom", color=color.new(color.green, 60))
fill(hDemHi, hDemLo, color=color.new(color.green, 82), title="Demand 4311–4325")
// ── Buy entry zone 4375–4392 (full width, price-anchored) ──
hBuyHi = hline(buyEntryHi, "Buy zone top", color=color.new(color.lime, 55))
hBuyLo = hline(buyEntryLo, "Buy zone bottom", color=color.new(color.lime, 55))
fill(hBuyHi, hBuyLo, color=color.new(color.lime, 80), title="Buy entry zone")
// ── Sell entry zone 4395–4413 (full width, price-anchored) ──
hSelHi = hline(selEntryHi, "Sell zone top", color=color.new(color.maroon, 55))
hSelLo = hline(selEntryLo, "Sell zone bottom", color=color.new(color.maroon, 55))
fill(hSelHi, hSelLo, color=color.new(color.maroon, 80), title="Sell entry zone")
// ── Pivots ──
hline(dP, "Daily P 4402.71", color=color.new(color.aqua, 20), linestyle=hline.style_solid, linewidth=2)
hline(dR1, "Daily R1 4439.88", color=color.new(color.red, 30), linestyle=hline.style_dashed)
hline(dR2, "Daily R2 4460.25", color=color.new(color.red, 40), linestyle=hline.style_dashed)
hline(dS1, "Daily S1 4382.34", color=color.new(color.green, 30), linestyle=hline.style_dashed)
hline(dS2, "Daily S2 4345.17", color=color.new(color.green, 40), linestyle=hline.style_dashed)
hline(dS3, "Daily S3 4324.80", color=color.new(color.green, 50), linestyle=hline.style_dashed)
hline(wP, "Weekly P 4377.09", color=color.new(color.orange, 20), linestyle=hline.style_solid, linewidth=2)
hline(wS1, "Weekly S1 4311.24", color=color.new(color.orange, 40), linestyle=hline.style_dashed)
// ── Invalidation / Target lines for trade ideas ──
hline(buyInvalid, "BUY invalid 4359.51", color=color.new(color.red, 20), linestyle=hline.style_dotted, linewidth=2)
hline(buyTarget1, "BUY T1 4439.88", color=color.new(color.lime, 20), linestyle=hline.style_dotted, linewidth=2)
hline(buyTarget2, "BUY T2 4460.25", color=color.new(color.lime, 40), linestyle=hline.style_dotted)
hline(selTarget1, "SELL T1 4345", color=color.new(color.maroon, 20), linestyle=hline.style_dotted, linewidth=2)
hline(selTarget2, "SELL T2 4324", color=color.new(color.maroon, 40), linestyle=hline.style_dotted)
// ── One-shot label + banner drawing on last confirmed bar (no repaint) ──
if barstate.islastconfirmedhistory
label.new(bar_index, dP, "Daily P 4402.71 — decider", style=label.style_label_left, color=color.new(color.aqua, 20), textcolor=color.white, size=size.small)
label.new(bar_index, wP, "Weekly P 4377.09 + 0.5 fib", style=label.style_label_left, color=color.new(color.orange, 20), textcolor=color.white, size=size.small)
label.new(bar_index, fib0618, "Golden pocket floor 4359.51", style=label.style_label_left, color=color.new(color.yellow, 20), textcolor=color.black, size=size.small)
label.new(bar_index, buyTarget1, "BUY T1 / Daily R1", style=label.style_label_left, color=color.new(color.lime, 20), textcolor=color.black, size=size.small)
label.new(bar_index, selTarget1, "SELL T1 / Daily S2", style=label.style_label_left, color=color.new(color.maroon, 20), textcolor=color.white, size=size.small)
label.new(bar_index, deepEntryHi, "Deep-dip swing buy 4324–4340", style=label.style_label_left, color=color.new(color.green, 30), textcolor=color.white, size=size.small)
var table banner = table.new(position.top_right, 2, 4, border_width=1)
table.cell(banner, 0, 0, "NET BIAS", bgcolor=color.new(color.black, 20), text_color=color.white, text_size=size.small)
table.cell(banner, 1, 0, "BUY (dip)", bgcolor=color.new(color.green, 20), text_color=color.white, text_size=size.small)
table.cell(banner, 0, 1, "Real 10y", bgcolor=color.new(color.black, 20), text_color=color.white, text_size=size.tiny)
table.cell(banner, 1, 1, "2.44% +3bp", bgcolor=color.new(color.black, 40), text_color=color.white, text_size=size.tiny)
table.cell(banner, 0, 2, "DXY", bgcolor=color.new(color.black, 20), text_color=color.white, text_size=size.tiny)
table.cell(banner, 1, 2, "99.65 soft",bgcolor=color.new(color.black, 40), text_color=color.white, text_size=size.tiny)
table.cell(banner, 0, 3, "Fed Sep", bgcolor=color.new(color.black, 20), text_color=color.white, text_size=size.tiny)
table.cell(banner, 1, 3, "66H/34hike",bgcolor=color.new(color.black, 40), text_color=color.white, text_size=size.tiny)
// ── Session gate: London (07-11 UTC) + NY (12-16 UTC) ──
h = hour(time, "UTC")
sess = (h >= 7 and h < 11) or (h >= 12 and h < 16)
// ── Close-confirmed trigger logic (no repaint) ──
tagBuyZone = low <= buyEntryHi and low >= buyEntryLo
tagSelZone = high >= selEntryLo and high <= selEntryHi
tagDeepZone = low <= deepEntryHi and low >= deepEntryLo
buyTrig = barstate.isconfirmed and sess and ta.crossover(close, dP) and ta.valuewhen(tagBuyZone, 1, 0) <= 5
selTrig = barstate.isconfirmed and sess and ta.crossunder(close, wP) and tagSelZone
deepTrig = barstate.isconfirmed and sess and ta.crossover(close, deepEntryHi) and ta.valuewhen(tagDeepZone, 1, 0) <= 5
buyInv = barstate.isconfirmed and ta.crossunder(close, buyInvalid)
selInv = barstate.isconfirmed and ta.crossover(close, selInvalid)
deepInv = barstate.isconfirmed and ta.crossunder(close, deepInvalid)
buyTgt = barstate.isconfirmed and ta.crossover(close, buyTarget1)
selTgt = barstate.isconfirmed and ta.crossunder(close, selTarget1)
deepTgt = barstate.isconfirmed and ta.crossover(close, deepTarget)
// ── Alerts ──
alertcondition(buyTrig, title="BUY armed — golden-pocket reclaim", message="XAUUSD: BUY trigger confirmed — close back above daily pivot 4402.71 after golden-pocket tag (London/NY session).")
alertcondition(buyInv, title="BUY invalidated", message="XAUUSD: BUY invalidated — close below 4359.51 (0.618 fib).")
alertcondition(buyTgt, title="BUY target 1 hit", message="XAUUSD: BUY T1 hit — close above 4439.88 (Daily R1). Trail toward 4460.25.")
alertcondition(selTrig, title="SELL armed — pivot-rejection fade", message="XAUUSD: SELL trigger confirmed — 4h close below weekly pivot 4377 with rejection at 4402.71.")
alertcondition(selInv, title="SELL invalidated", message="XAUUSD: SELL invalidated — close above 4413 (0.236 fib).")
alertcondition(selTgt, title="SELL target 1 hit", message="XAUUSD: SELL T1 hit — close below 4345 (Daily S2). Trail toward 4324.")
alertcondition(deepTrig, title="Deep-dip BUY armed — weekly S1", message="XAUUSD: Deep-dip BUY trigger — close reclaim of 4336–4340 after tapping the 4311–4325 demand.")
alertcondition(deepInv, title="Deep-dip BUY invalidated", message="XAUUSD: Deep-dip BUY invalidated — close below weekly S1 4311.24.")
alertcondition(deepTgt, title="Deep-dip BUY target hit", message="XAUUSD: Deep-dip BUY target hit — close above 4402 (daily pivot).")
// ── Per-setup STATE labels (close-confirmed, single-draw guard) ──
var string buyState = "ARMED"
var string selState = "ARMED"
var string deepState = "ARMED"
if barstate.isconfirmed
if buyTgt
buyState := "TARGET HIT"
else if buyInv
buyState := "INVALIDATED"
else if buyTrig
buyState := "TRIGGERED"
if selTgt
selState := "TARGET HIT"
else if selInv
selState := "INVALIDATED"
else if selTrig
selState := "TRIGGERED"
if deepTgt
deepState := "TARGET HIT"
else if deepInv
deepState := "INVALIDATED"
else if deepTrig
deepState := "TRIGGERED"
if barstate.islastconfirmedhistory
var table stateTbl = table.new(position.bottom_right, 2, 3, border_width=1)
table.cell(stateTbl, 0, 0, "BUY (pocket)", bgcolor=color.new(color.green, 25), text_color=color.white, text_size=size.small)
table.cell(stateTbl, 1, 0, buyState, bgcolor=color.new(color.black, 30), text_color=color.white, text_size=size.small)
table.cell(stateTbl, 0, 1, "SELL (fade)", bgcolor=color.new(color.maroon, 25), text_color=color.white, text_size=size.small)
table.cell(stateTbl, 1, 1, selState, bgcolor=color.new(color.black, 30), text_color=color.white, text_size=size.small)
table.cell(stateTbl, 0, 2, "BUY (deep-dip)", bgcolor=color.new(color.green, 45), text_color=color.white, text_size=size.small)
table.cell(stateTbl, 1, 2, deepState, bgcolor=color.new(color.black, 30), text_color=color.white, text_size=size.small)
{"bias": "BUY",
"ideas": [
{"bias": "BUY", "label": "Golden-pocket reclaim", "entry_low": 4375, "entry_high": 4392,
"invalidation": 4359.51, "target": 4439.88, "conviction": 55},
{"bias": "SELL", "label": "Pivot-rejection fade", "entry_low": 4395, "entry_high": 4413,
"invalidation": 4413, "target": 4345, "conviction": 35},
{"bias": "BUY", "label": "Deep-dip swing", "entry_low": 4324, "entry_high": 4340,
"invalidation": 4311.24, "target": 4402, "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 BUY", overlay=true, max_lines_count=300, max_labels_count=300, max_boxes_count=100)
// ── Inputs / anchors from the desk note ──
swingHi = 4442.95
swingLo = 4307.93
rng = swingHi - swingLo
fib0236 = swingHi - rng * 0.236
fib0382 = swingHi - rng * 0.382
fib0500 = swingHi - rng * 0.500
fib0618 = swingHi - rng * 0.618
fib0786 = swingHi - rng * 0.786
// ── Pivots (from brief) ──
dP = 4402.71
dR1 = 4439.88
dR2 = 4460.25
dS1 = 4382.34
dS2 = 4345.17
dS3 = 4324.80
wP = 4377.09
wS1 = 4311.24
// ── Trade levels (from the trade table) ──
buyEntryLo = 4375.0
buyEntryHi = 4392.0
buyInvalid = 4359.51
buyTarget1 = 4439.88
buyTarget2 = 4460.25
selEntryLo = 4395.0
selEntryHi = 4413.0
selInvalid = 4413.0
selTarget1 = 4345.0
selTarget2 = 4324.0
deepEntryLo = 4324.0
deepEntryHi = 4340.0
deepInvalid = 4311.24
deepTarget = 4402.0
// ── 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)
// ── Fibonacci retracement (full-width, price-anchored) ──
hFibHi = hline(swingHi, "Swing High 4442.95", color=color.new(color.gray, 30), linestyle=hline.style_dotted)
hFib0236 = hline(fib0236, "0.236", color=color.new(color.teal, 40))
hFib0382 = hline(fib0382, "0.382", color=color.new(color.teal, 40))
hFib0500 = hline(fib0500, "0.500 (pocket top)", color=color.new(color.yellow, 20), linestyle=hline.style_dashed)
hFib0618 = hline(fib0618, "0.618 (pocket low)", color=color.new(color.yellow, 20), linestyle=hline.style_dashed)
hFib0786 = hline(fib0786, "0.786", color=color.new(color.teal, 40))
hFibLo = hline(swingLo, "Swing Low 4307.93", color=color.new(color.gray, 30), linestyle=hline.style_dotted)
// ── Golden pocket 0.5–0.618 shaded band ──
fill(hFib0500, hFib0618, color=color.new(color.yellow, 82), title="Golden pocket 0.5–0.618")
// ── Supply zone (session high + weekly swing) 4430–4443 ──
hSupplyHi = hline(4442.95, "Supply top", color=color.new(color.red, 60))
hSupplyLo = hline(4430.00, "Supply bottom", color=color.new(color.red, 60))
fill(hSupplyHi, hSupplyLo, color=color.new(color.red, 82), title="Supply 4430–4443")
// ── Demand zone (weekly-S1 cluster) 4311–4324 ──
hDemHi = hline(4324.80, "Demand top", color=color.new(color.green, 60))
hDemLo = hline(4311.24, "Demand bottom", color=color.new(color.green, 60))
fill(hDemHi, hDemLo, color=color.new(color.green, 82), title="Demand 4311–4325")
// ── Buy entry zone 4375–4392 (full width, price-anchored) ──
hBuyHi = hline(buyEntryHi, "Buy zone top", color=color.new(color.lime, 55))
hBuyLo = hline(buyEntryLo, "Buy zone bottom", color=color.new(color.lime, 55))
fill(hBuyHi, hBuyLo, color=color.new(color.lime, 80), title="Buy entry zone")
// ── Sell entry zone 4395–4413 (full width, price-anchored) ──
hSelHi = hline(selEntryHi, "Sell zone top", color=color.new(color.maroon, 55))
hSelLo = hline(selEntryLo, "Sell zone bottom", color=color.new(color.maroon, 55))
fill(hSelHi, hSelLo, color=color.new(color.maroon, 80), title="Sell entry zone")
// ── Pivots ──
hline(dP, "Daily P 4402.71", color=color.new(color.aqua, 20), linestyle=hline.style_solid, linewidth=2)
hline(dR1, "Daily R1 4439.88", color=color.new(color.red, 30), linestyle=hline.style_dashed)
hline(dR2, "Daily R2 4460.25", color=color.new(color.red, 40), linestyle=hline.style_dashed)
hline(dS1, "Daily S1 4382.34", color=color.new(color.green, 30), linestyle=hline.style_dashed)
hline(dS2, "Daily S2 4345.17", color=color.new(color.green, 40), linestyle=hline.style_dashed)
hline(dS3, "Daily S3 4324.80", color=color.new(color.green, 50), linestyle=hline.style_dashed)
hline(wP, "Weekly P 4377.09", color=color.new(color.orange, 20), linestyle=hline.style_solid, linewidth=2)
hline(wS1, "Weekly S1 4311.24", color=color.new(color.orange, 40), linestyle=hline.style_dashed)
// ── Invalidation / Target lines for trade ideas ──
hline(buyInvalid, "BUY invalid 4359.51", color=color.new(color.red, 20), linestyle=hline.style_dotted, linewidth=2)
hline(buyTarget1, "BUY T1 4439.88", color=color.new(color.lime, 20), linestyle=hline.style_dotted, linewidth=2)
hline(buyTarget2, "BUY T2 4460.25", color=color.new(color.lime, 40), linestyle=hline.style_dotted)
hline(selTarget1, "SELL T1 4345", color=color.new(color.maroon, 20), linestyle=hline.style_dotted, linewidth=2)
hline(selTarget2, "SELL T2 4324", color=color.new(color.maroon, 40), linestyle=hline.style_dotted)
// ── One-shot label + banner drawing on last confirmed bar (no repaint) ──
if barstate.islastconfirmedhistory
label.new(bar_index, dP, "Daily P 4402.71 — decider", style=label.style_label_left, color=color.new(color.aqua, 20), textcolor=color.white, size=size.small)
label.new(bar_index, wP, "Weekly P 4377.09 + 0.5 fib", style=label.style_label_left, color=color.new(color.orange, 20), textcolor=color.white, size=size.small)
label.new(bar_index, fib0618, "Golden pocket floor 4359.51", style=label.style_label_left, color=color.new(color.yellow, 20), textcolor=color.black, size=size.small)
label.new(bar_index, buyTarget1, "BUY T1 / Daily R1", style=label.style_label_left, color=color.new(color.lime, 20), textcolor=color.black, size=size.small)
label.new(bar_index, selTarget1, "SELL T1 / Daily S2", style=label.style_label_left, color=color.new(color.maroon, 20), textcolor=color.white, size=size.small)
label.new(bar_index, deepEntryHi, "Deep-dip swing buy 4324–4340", style=label.style_label_left, color=color.new(color.green, 30), textcolor=color.white, size=size.small)
var table banner = table.new(position.top_right, 2, 4, border_width=1)
table.cell(banner, 0, 0, "NET BIAS", bgcolor=color.new(color.black, 20), text_color=color.white, text_size=size.small)
table.cell(banner, 1, 0, "BUY (dip)", bgcolor=color.new(color.green, 20), text_color=color.white, text_size=size.small)
table.cell(banner, 0, 1, "Real 10y", bgcolor=color.new(color.black, 20), text_color=color.white, text_size=size.tiny)
table.cell(banner, 1, 1, "2.44% +3bp", bgcolor=color.new(color.black, 40), text_color=color.white, text_size=size.tiny)
table.cell(banner, 0, 2, "DXY", bgcolor=color.new(color.black, 20), text_color=color.white, text_size=size.tiny)
table.cell(banner, 1, 2, "99.65 soft",bgcolor=color.new(color.black, 40), text_color=color.white, text_size=size.tiny)
table.cell(banner, 0, 3, "Fed Sep", bgcolor=color.new(color.black, 20), text_color=color.white, text_size=size.tiny)
table.cell(banner, 1, 3, "66H/34hike",bgcolor=color.new(color.black, 40), text_color=color.white, text_size=size.tiny)
// ── Session gate: London (07-11 UTC) + NY (12-16 UTC) ──
h = hour(time, "UTC")
sess = (h >= 7 and h < 11) or (h >= 12 and h < 16)
// ── Close-confirmed trigger logic (no repaint) ──
tagBuyZone = low <= buyEntryHi and low >= buyEntryLo
tagSelZone = high >= selEntryLo and high <= selEntryHi
tagDeepZone = low <= deepEntryHi and low >= deepEntryLo
buyTrig = barstate.isconfirmed and sess and ta.crossover(close, dP) and ta.valuewhen(tagBuyZone, 1, 0) <= 5
selTrig = barstate.isconfirmed and sess and ta.crossunder(close, wP) and tagSelZone
deepTrig = barstate.isconfirmed and sess and ta.crossover(close, deepEntryHi) and ta.valuewhen(tagDeepZone, 1, 0) <= 5
buyInv = barstate.isconfirmed and ta.crossunder(close, buyInvalid)
selInv = barstate.isconfirmed and ta.crossover(close, selInvalid)
deepInv = barstate.isconfirmed and ta.crossunder(close, deepInvalid)
buyTgt = barstate.isconfirmed and ta.crossover(close, buyTarget1)
selTgt = barstate.isconfirmed and ta.crossunder(close, selTarget1)
deepTgt = barstate.isconfirmed and ta.crossover(close, deepTarget)
// ── Alerts ──
alertcondition(buyTrig, title="BUY armed — golden-pocket reclaim", message="XAUUSD: BUY trigger confirmed — close back above daily pivot 4402.71 after golden-pocket tag (London/NY session).")
alertcondition(buyInv, title="BUY invalidated", message="XAUUSD: BUY invalidated — close below 4359.51 (0.618 fib).")
alertcondition(buyTgt, title="BUY target 1 hit", message="XAUUSD: BUY T1 hit — close above 4439.88 (Daily R1). Trail toward 4460.25.")
alertcondition(selTrig, title="SELL armed — pivot-rejection fade", message="XAUUSD: SELL trigger confirmed — 4h close below weekly pivot 4377 with rejection at 4402.71.")
alertcondition(selInv, title="SELL invalidated", message="XAUUSD: SELL invalidated — close above 4413 (0.236 fib).")
alertcondition(selTgt, title="SELL target 1 hit", message="XAUUSD: SELL T1 hit — close below 4345 (Daily S2). Trail toward 4324.")
alertcondition(deepTrig, title="Deep-dip BUY armed — weekly S1", message="XAUUSD: Deep-dip BUY trigger — close reclaim of 4336–4340 after tapping the 4311–4325 demand.")
alertcondition(deepInv, title="Deep-dip BUY invalidated", message="XAUUSD: Deep-dip BUY invalidated — close below weekly S1 4311.24.")
alertcondition(deepTgt, title="Deep-dip BUY target hit", message="XAUUSD: Deep-dip BUY target hit — close above 4402 (daily pivot).")
// ── Per-setup STATE labels (close-confirmed, single-draw guard) ──
var string buyState = "ARMED"
var string selState = "ARMED"
var string deepState = "ARMED"
if barstate.isconfirmed
if buyTgt
buyState := "TARGET HIT"
else if buyInv
buyState := "INVALIDATED"
else if buyTrig
buyState := "TRIGGERED"
if selTgt
selState := "TARGET HIT"
else if selInv
selState := "INVALIDATED"
else if selTrig
selState := "TRIGGERED"
if deepTgt
deepState := "TARGET HIT"
else if deepInv
deepState := "INVALIDATED"
else if deepTrig
deepState := "TRIGGERED"
if barstate.islastconfirmedhistory
var table stateTbl = table.new(position.bottom_right, 2, 3, border_width=1)
table.cell(stateTbl, 0, 0, "BUY (pocket)", bgcolor=color.new(color.green, 25), text_color=color.white, text_size=size.small)
table.cell(stateTbl, 1, 0, buyState, bgcolor=color.new(color.black, 30), text_color=color.white, text_size=size.small)
table.cell(stateTbl, 0, 1, "SELL (fade)", bgcolor=color.new(color.maroon, 25), text_color=color.white, text_size=size.small)
table.cell(stateTbl, 1, 1, selState, bgcolor=color.new(color.black, 30), text_color=color.white, text_size=size.small)
table.cell(stateTbl, 0, 2, "BUY (deep-dip)", bgcolor=color.new(color.green, 45), text_color=color.white, text_size=size.small)
table.cell(stateTbl, 1, 2, deepState, bgcolor=color.new(color.black, 30), text_color=color.white, text_size=size.small)
— the resident
Buy the pocket, respect the pivot