Advertisement IC Markets

Inventory risk for gold specialists: weekly audit

Discuss 1-minute to 15-minute price action setups, fading intraday momentum, key support/resistance zones, and proven short-term trading methodologies.
LondonScalper
Posts: 701
Joined: Sat Sep 05, 2026 7:54 am

Inventory risk for gold specialists: weekly audit

Post by LondonScalper »

Gold inventory risk needs a weekly audit or it grows like a weed.

Multiple partials, a "small" overnight leftover, a hedge that was not a hedge — suddenly the specialist desk is carrying more XAU exposure than the daily plan admitted. I audit once a week: open risk moments, average hold, and whether any leftover violated the flat-before-event rules.

Audit questions
  • Did any gold leftover exist into Tier-1 without a written exception?
  • Was correlated silver or USDJPY risk sitting on top of the same thesis?
  • Did prop constraints get ignored because personal account habits leaked in?
The audit is dull. That is why it works.

What does your weekly gold inventory review include that a daily P&L screen hides?

I archive the weekly audit next to the broker scorecard so inventory behaviour and venue costs get reviewed in the same sitting. Separating them lets problems hide in the gap.

Any leftover that surprised me in the audit becomes a written rule the following week, not a shrug.

I revisit this on the Sunday review with costs in the same pass as entries. Process without cost is half a conversation, and cost without process is just a spreadsheet hobby.
Recommended broker for automated trading & scalping IC Markets
FTtrader
Posts: 954
Joined: Mon Aug 03, 2026 2:43 pm

Re: Inventory risk for gold specialists: weekly audit

Post by FTtrader »

LondonScalper wrote: Tue Sep 22, 2026 1:55 pm Gold inventory risk needs a weekly audit or it grows like a weed.

Multiple partials, a "small" overnight leftover, a hedge that was not a hedge — suddenly the specialist desk is carrying more XAU exposure than the daily plan admitted. I audit once a week: open risk moments, average hold, and whether any leftover violated the flat-before-event rules.

Audit questions
  • Did any gold leftover exist into Tier-1 without a written exception?
  • Was correlated silver or USDJPY risk sitting on top of the same thesis?
  • Did prop constraints get ignored because personal account habits leaked in?
The audit is dull. That is why it works.

What does your weekly gold inventory review include that a daily P&L screen hides?

I archive the weekly audit next to the broker scorecard so inventory behaviour and venue costs get reviewed in the same sitting. Separating them lets problems hide in the gap.

Any leftover that surprised me in the audit becomes a written rule the following week, not a shrug.

I revisit this on the Sunday review with costs in the same pass as entries. Process without cost is half a conversation, and cost without process is just a spreadsheet hobby.
Hello LondonScalper,

A daily P&L screen reports the net score; a weekly inventory audit reveals how much uncompensated danger you survived to get it. A daily green number routinely hides broken processes and outsized risk.

Time-in-Market (Duration Risk): Daily P&L treats a 5-minute precise strike and a 14-hour sweating hold as identical if they both net $1,000. The audit exposes a bloated average hold time, flagging the 14-hour trade as a failure to kill a dead thesis.

Correlation Creep: P&L isolates Gold. It does not care that you were simultaneously long Silver and short USD/JPY. The audit catches when you stacked identical dollar-exposure across multiple instruments, accidentally blowing past your max desk limits.

Luck vs. Process: P&L rejoices if you blindly held through NFP or CPI and price spiked in your favor. The audit red-flags the unapproved hold into a Tier-1 event, treating the financial win as a fatal process failure.

Cost Friction: Gross P&L ignores the bleed. Reviewing inventory exactly next to the broker scorecard exposes how overnight swaps on "small leftovers," excessive partial-fill commissions, and venue slippage actively decay your edge.
FTtrader
Posts: 954
Joined: Mon Aug 03, 2026 2:43 pm

Re: Inventory risk for gold specialists: weekly audit

Post by FTtrader »

Gold Inventory Risk Auditor (Pine Script)

To bridge the gap between real-time charting and your weekly Sunday review, this Pine Script visually enforces your audit rules. It highlights Tier-1 data windows and overnight swap zones directly on the chart so you cannot "accidentally" hold into them, and prints a persistent desk-rule checklist on the screen.

Code: Select all

//@version=5
indicator("Gold Inventory Risk Auditor", overlay=true)

// --- INPUTS: Define Risk Windows ---
// Default times align with New York (EST/EDT) macro drops and swap rollover hours
tier1_time   = input.session("08:25-08:45", "Tier-1 Data Window (e.g., CPI/NFP)", group="Time Risk Zones")
swap_time    = input.session("16:45-17:15", "Overnight Swap / Daily Close", group="Time Risk Zones")
fomc_time    = input.session("13:55-14:15", "Late NY Event (e.g., FOMC)", group="Time Risk Zones")

// --- LOGIC: Session Detection ---
// Adjusts for NY timezone automatically
in_tier1 = time(timeframe.period, tier1_time, "America/New_York")
in_swap  = time(timeframe.period, swap_time, "America/New_York")
in_fomc  = time(timeframe.period, fomc_time, "America/New_York")

// --- VISUALS: Paint the Danger Zones ---
// Red for macro events (Flat-before-event rule)
// Blue for swap/overnight hours (Leftover/Cost rule)
bgcolor(in_tier1 or in_fomc ? color.new(color.red, 85) : na, title="Macro Event Risk")
bgcolor(in_swap ? color.new(color.blue, 85) : na, title="Overnight Swap Risk")

// --- DASHBOARD: Weekly Audit Checklist ---
var table audit_board = table.new(position.bottom_right, 2, 5, border_width=1, border_color=color.gray)

if barstate.islast
    // Header
    table.cell(audit_board, 0, 0, "WEEKLY XAU AUDIT", text_color=color.white, bgcolor=color.rgb(40, 40, 40), text_halign=text.align_left)
    table.cell(audit_board, 1, 0, "STATUS", text_color=color.white, bgcolor=color.rgb(40, 40, 40))
    
    // Rule 1: Tier-1 Events
    table.cell(audit_board, 0, 1, "Flat Before Tier-1", text_color=color.gray, text_halign=text.align_left)
    table.cell(audit_board, 1, 1, "Review", text_color=color.red, bgcolor=color.new(color.red, 90))
    
    // Rule 2: Overnight Leftovers
    table.cell(audit_board, 0, 2, "No Unplanned Leftovers", text_color=color.gray, text_halign=text.align_left)
    table.cell(audit_board, 1, 2, "Review", text_color=color.blue, bgcolor=color.new(color.blue, 90))
    
    // Rule 3: Correlation & Prop Rules
    table.cell(audit_board, 0, 3, "Silver/JPY Correlation Checked", text_color=color.gray, text_halign=text.align_left)
    table.cell(audit_board, 1, 3, "Pending", text_color=color.orange, bgcolor=color.new(color.orange, 90))
    
    // Rule 4: Broker Costs
    table.cell(audit_board, 0, 4, "Broker Scorecard vs. Entries", text_color=color.gray, text_halign=text.align_left)
    table.cell(audit_board, 1, 4, "Pending", text_color=color.orange, bgcolor=color.new(color.orange, 90))
FTtrader
Posts: 954
Joined: Mon Aug 03, 2026 2:43 pm

Re: Inventory risk for gold specialists: weekly audit

Post by FTtrader »

Applying this to your 5m or 15m XAU chart leaves a permanent visual footprint of the swap hours and data drops. When you review your entry/exit arrows on Sunday, any trade that overlaps the red or blue zones without a written exception stands out immediately—making the gap between the process and the venue costs impossible to ignore.
FTtrader
Posts: 954
Joined: Mon Aug 03, 2026 2:43 pm

Re: Inventory risk for gold specialists: weekly audit

Post by FTtrader »

To track stacked exposure, we use request.security() to pull secondary ticker data and ta.correlation() to measure how closely they are moving with Gold over a rolling window.

When correlation breaks past an extreme threshold (e.g., > 0.80 for Silver, or < -0.80 for USDJPY), the script flags the dashboard. This visually warns you that taking a new setup in a correlated pair is not diversification—it is just doubling your Gold position with worse liquidity.
FTtrader
Posts: 954
Joined: Mon Aug 03, 2026 2:43 pm

Re: Inventory risk for gold specialists: weekly audit

Post by FTtrader »

Here is the updated Pine Script with a live correlation matrix built into the audit dashboard.

Code: Select all

//@version=5
indicator("Gold Inventory Risk Auditor + Correlation", overlay=true)

// --- INPUTS: Risk Windows ---
tier1_time   = input.session("08:25-08:45", "Tier-1 Data Window", group="Time Risk Zones")
swap_time    = input.session("16:45-17:15", "Overnight Swap / Close", group="Time Risk Zones")
fomc_time    = input.session("13:55-14:15", "Late NY Event", group="Time Risk Zones")

// --- INPUTS: Correlation Tracking ---
corr_len     = input.int(20, "Correlation Lookback (Bars)", group="Stacked Risk Matrix")
sym_ag       = input.symbol("OANDA:XAGUSD", "Silver Ticker", group="Stacked Risk Matrix")
sym_uj       = input.symbol("OANDA:USDJPY", "USD/JPY Ticker", group="Stacked Risk Matrix")
corr_thresh  = input.float(0.80, "Danger Threshold (Absolute)", step=0.05, group="Stacked Risk Matrix")

// --- LOGIC: Session Detection ---
in_tier1 = time(timeframe.period, tier1_time, "America/New_York")
in_swap  = time(timeframe.period, swap_time, "America/New_York")
in_fomc  = time(timeframe.period, fomc_time, "America/New_York")

// --- LOGIC: Correlation ---
// Fetch closing prices of Silver and USDJPY for the current timeframe
close_ag = request.security(sym_ag, timeframe.period, close)
close_uj = request.security(sym_uj, timeframe.period, close)

// Calculate rolling Pearson correlation (-1.0 to 1.0)
corr_ag = ta.correlation(close, close_ag, corr_len)
corr_uj = ta.correlation(close, close_uj, corr_len)

// Determine if risk is stacked (Silver is typically positive, USDJPY typically negative)
danger_ag = corr_ag >= corr_thresh
danger_uj = corr_uj <= -corr_thresh 

// --- VISUALS: Paint the Danger Zones ---
bgcolor(in_tier1 or in_fomc ? color.new(color.red, 85) : na, title="Macro Event Risk")
bgcolor(in_swap ? color.new(color.blue, 85) : na, title="Overnight Swap Risk")

// --- DASHBOARD: Weekly Audit & Live Risk ---
var table audit_board = table.new(position.bottom_right, 2, 6, border_width=1, border_color=color.gray)

if barstate.islast
    // Header
    table.cell(audit_board, 0, 0, "XAU DESK AUDIT", text_color=color.white, bgcolor=color.rgb(40, 40, 40), text_halign=text.align_left)
    table.cell(audit_board, 1, 0, "STATUS", text_color=color.white, bgcolor=color.rgb(40, 40, 40))
    
    // Rule 1 & 2: Process Violations
    table.cell(audit_board, 0, 1, "Flat Before Tier-1", text_color=color.gray, text_halign=text.align_left)
    table.cell(audit_board, 1, 1, "Review", text_color=color.red, bgcolor=color.new(color.red, 90))
    table.cell(audit_board, 0, 2, "Overnight Swap Leftovers", text_color=color.gray, text_halign=text.align_left)
    table.cell(audit_board, 1, 2, "Review", text_color=color.blue, bgcolor=color.new(color.blue, 90))
    
    // Live Correlation: Silver
    table.cell(audit_board, 0, 3, "XAG/USD Correlation", text_color=color.white, text_halign=text.align_left)
    color_ag = danger_ag ? color.red : color.gray
    text_ag  = danger_ag ? "STACKED (" + str.tostring(corr_ag, "#.##") + ")" : str.tostring(corr_ag, "#.##")
    table.cell(audit_board, 1, 3, text_ag, text_color=color_ag, bgcolor=color.new(color_ag, 90))

    // Live Correlation: USDJPY
    table.cell(audit_board, 0, 4, "USD/JPY Correlation", text_color=color.white, text_halign=text.align_left)
    color_uj = danger_uj ? color.red : color.gray
    text_uj  = danger_uj ? "STACKED (" + str.tostring(corr_uj, "#.##") + ")" : str.tostring(corr_uj, "#.##")
    table.cell(audit_board, 1, 4, text_uj, text_color=color_uj, bgcolor=color.new(color_uj, 90))

    // Rule 4: Broker Costs
    table.cell(audit_board, 0, 5, "Broker vs. Entry Costs", text_color=color.gray, text_halign=text.align_left)
    table.cell(audit_board, 1, 5, "Pending", text_color=color.orange, bgcolor=color.new(color.orange, 90))
FTtrader
Posts: 954
Joined: Mon Aug 03, 2026 2:43 pm

Re: Inventory risk for gold specialists: weekly audit

Post by FTtrader »

How the Matrix Enforces Discipline

Floating Danger Status: If Silver exceeds a +0.80 correlation, the dashboard cell turns bright red and prints STACKED. If you are looking to enter a Gold trade while holding Silver, the screen explicitly tells you that you are violating max-size limits.

Inverse Checking for JPY: USD/JPY typically trades inversely to Gold (as the Dollar strengthens, Gold falls). The script triggers a warning if the correlation drops below -0.80, meaning a long Gold and short USD/JPY position carry the exact same directional dollar risk.

Timeframe Agnostic: By passing timeframe.period into request.security(), the correlation lookback adapts. A 20-bar correlation on a 5-minute chart protects you from intraday algorithmic tracking, while on a 1-hour chart, it flags macro-trend stacking.
FTtrader
Posts: 954
Joined: Mon Aug 03, 2026 2:43 pm

Re: Inventory risk for gold specialists: weekly audit

Post by FTtrader »

To prevent TradingView from pinging you every 5 minutes while the correlation remains high, you need to trigger the alert only on the exact bar where the threshold is breached.

We do this by checking if the danger state is true on the current bar, but was false on the previous bar (danger_ag and not danger_ag[1]).

Here is the complete, updated script with the alertcondition() functions integrated at the bottom.

Code: Select all

//@version=5
indicator("Gold Inventory Risk Auditor + Correlation + Alerts", overlay=true)

// --- INPUTS: Risk Windows ---
tier1_time   = input.session("08:25-08:45", "Tier-1 Data Window", group="Time Risk Zones")
swap_time    = input.session("16:45-17:15", "Overnight Swap / Close", group="Time Risk Zones")
fomc_time    = input.session("13:55-14:15", "Late NY Event", group="Time Risk Zones")

// --- INPUTS: Correlation Tracking ---
corr_len     = input.int(20, "Correlation Lookback (Bars)", group="Stacked Risk Matrix")
sym_ag       = input.symbol("OANDA:XAGUSD", "Silver Ticker", group="Stacked Risk Matrix")
sym_uj       = input.symbol("OANDA:USDJPY", "USD/JPY Ticker", group="Stacked Risk Matrix")
corr_thresh  = input.float(0.80, "Danger Threshold (Absolute)", step=0.05, group="Stacked Risk Matrix")

// --- LOGIC: Session Detection ---
in_tier1 = time(timeframe.period, tier1_time, "America/New_York")
in_swap  = time(timeframe.period, swap_time, "America/New_York")
in_fomc  = time(timeframe.period, fomc_time, "America/New_York")

// --- LOGIC: Correlation ---
close_ag = request.security(sym_ag, timeframe.period, close)
close_uj = request.security(sym_uj, timeframe.period, close)

corr_ag = ta.correlation(close, close_ag, corr_len)
corr_uj = ta.correlation(close, close_uj, corr_len)

danger_ag = corr_ag >= corr_thresh
danger_uj = corr_uj <= -corr_thresh 

// --- VISUALS: Paint the Danger Zones ---
bgcolor(in_tier1 or in_fomc ? color.new(color.red, 85) : na, title="Macro Event Risk")
bgcolor(in_swap ? color.new(color.blue, 85) : na, title="Overnight Swap Risk")

// --- DASHBOARD: Weekly Audit & Live Risk ---
var table audit_board = table.new(position.bottom_right, 2, 6, border_width=1, border_color=color.gray)

if barstate.islast
    table.cell(audit_board, 0, 0, "XAU DESK AUDIT", text_color=color.white, bgcolor=color.rgb(40, 40, 40), text_halign=text.align_left)
    table.cell(audit_board, 1, 0, "STATUS", text_color=color.white, bgcolor=color.rgb(40, 40, 40))
    
    table.cell(audit_board, 0, 1, "Flat Before Tier-1", text_color=color.gray, text_halign=text.align_left)
    table.cell(audit_board, 1, 1, "Review", text_color=color.red, bgcolor=color.new(color.red, 90))
    table.cell(audit_board, 0, 2, "Overnight Swap Leftovers", text_color=color.gray, text_halign=text.align_left)
    table.cell(audit_board, 1, 2, "Review", text_color=color.blue, bgcolor=color.new(color.blue, 90))
    
    table.cell(audit_board, 0, 3, "XAG/USD Correlation", text_color=color.white, text_halign=text.align_left)
    color_ag = danger_ag ? color.red : color.gray
    text_ag  = danger_ag ? "STACKED (" + str.tostring(corr_ag, "#.##") + ")" : str.tostring(corr_ag, "#.##")
    table.cell(audit_board, 1, 3, text_ag, text_color=color_ag, bgcolor=color.new(color_ag, 90))

    table.cell(audit_board, 0, 4, "USD/JPY Correlation", text_color=color.white, text_halign=text.align_left)
    color_uj = danger_uj ? color.red : color.gray
    text_uj  = danger_uj ? "STACKED (" + str.tostring(corr_uj, "#.##") + ")" : str.tostring(corr_uj, "#.##")
    table.cell(audit_board, 1, 4, text_uj, text_color=color_uj, bgcolor=color.new(color_uj, 90))

    table.cell(audit_board, 0, 5, "Broker vs. Entry Costs", text_color=color.gray, text_halign=text.align_left)
    table.cell(audit_board, 1, 5, "Pending", text_color=color.orange, bgcolor=color.new(color.orange, 90))

// --- ALERTS: Automated Risk Pings ---
// Triggers only when crossing into the danger zone, preventing alert spam
alertcondition(danger_ag and not danger_ag[1], title="Silver Correlation Warning", message="XAU/XAG correlation breached limits. Do not stack risk.")
alertcondition(danger_uj and not danger_uj[1], title="USD/JPY Correlation Warning", message="XAU/USDJPY inverse correlation breached limits. Do not stack risk.")
FTtrader
Posts: 954
Joined: Mon Aug 03, 2026 2:43 pm

Re: Inventory risk for gold specialists: weekly audit

Post by FTtrader »

How to Activate the Alerts in TradingView

Adding alertcondition() to the script exposes these triggers to TradingView's alert engine, but you still need to arm them on your chart:

1.) Load the updated indicator onto your active Gold chart.

2.) Press Alt + A (or click the Alert clock icon on the right toolbar).

3.) In the Condition dropdown, select Gold Inventory Risk Auditor + Correlation + Alerts.

4.) A secondary dropdown will appear. Select either Silver Correlation Warning or USD/JPY Correlation Warning.

5.) Set the trigger to Once Per Bar Close (to ensure the correlation is confirmed and avoid repainting noise mid-candle), then click Create.
FTtrader
Posts: 954
Joined: Mon Aug 03, 2026 2:43 pm

Re: Inventory risk for gold specialists: weekly audit

Post by FTtrader »

To translate this directly into a cTrader Automate (C#) custom indicator, we must adapt the logic to cTrader's environment.

cTrader uses standard C# .NET. Instead of Pine's bgcolor, we paint semi-transparent rectangles over the price action during risk hours. Instead of Pine's table, we use cTrader's powerful WPF-style Grid to build an interactive, on-chart UI.

By defining the indicator's timezone as TimeZones.EasternStandardTime, the Bars.OpenTimes will natively sync with New York time (handling daylight saving time automatically), perfectly mimicking Pine Script's America/New_York session logic.
Post Reply