OPEN-SOURCE SCRIPT

CFTC COT Structural Bias & OI Engine

345
CFTC COT Structural Bias
快照
The CFTC COT Structural Bias is an institutional sentiment and positioning indicator built on official Commodity Futures Trading Commission (CFTC) Commitment of Traders data. Designed specifically for Precious Metals (Gold, Silver, Platinum, Palladium) and Major Commodities (Copper, Crude Oil, Natural Gas, Agriculture), it automatically maps Spot/CFD tickers (like XAUUSD, XAGUSD, USOIL) to their underlying COMEX/NYMEX futures contracts and translates raw weekly contract data into an actionable macro trade bias.

1. How the Indicator Works

The Three Core Participant Groups Whether you select the Disaggregated (Grouped into 3 Categories) mode or the Legacy mode, the indicator organizes the futures market into three distinct player profiles, plus Open Interest:

Commercials / Hedgers (Blue Line — "Smart Money"):
Physical producers, miners, refiners, and bullion banks/swap dealers that deal in the actual underlying commodity. They use the futures market to hedge business risk and scale into positions against the prevailing trend—providing an early warning when prices are historically too high or too low.

Large Speculators (Green Line — "Trend Drivers"):
Hedge funds, Commodity Trading Advisors (CTAs), and institutional money managers who trade specifically to profit from directional price action. Because their capital flows drive medium-term trends, they are the primary fuel behind sustained rallies and sell-offs—until they become overly crowded.

Small Speculators (Amber Circles — "Retail Crowd"):
Smaller non-reportable retail traders. They tend to be most bullish at market tops and most bearish at market bottoms.

Total Open Interest ("Trend Fuel"):
The total number of active, unsettled futures contracts in the market, used to verify whether a price move is backed by fresh capital entering the market or existing traders closing out positions.
Mathematical Calculations & Visual Modes

You can switch between three analytical views in the indicator settings:
COT Index (0–100% Stochastic Oscillator — Default): Normalizes each group's current net position against its rolling 52-week high and low range using the formula:


COTIndex=100CurrentNet-LowestNet52WHighestNet52W-LowestNet52W

This allows you to immediately spot 52-week positioning extremes regardless of how much total market size has grown over the years.

Net Positions (Contracts): Plots the raw net contract balance (LongContracts-ShortContracts) for each group relative to the zero line.

Net % of Open Interest (WillCO): Normalizes each group's net contracts as a percentage of Total Open Interest:
$$\text{Net \% of OI} = \left(\frac{\text{Net Position}}{\text{Total Open Interest}}\right) \times 100$$

2. How to Identify Market Bias (The 5 Structural Rules)

The indicator's automated Bias Decision Engine evaluates five structural COT rules every time a new weekly CFTC report is released:

Fade the Speculative Crowd (Crowded Extremes):
Condition: Large Speculators reach $\ge 80\%$ AND Small Speculators reach $\ge 70\%$ (or $\le 20\%$ and $\le 30\%$ on the downside).
Market Meaning: When both institutional funds and retail traders are heavily crowded on one side of the market, there is no one left to buy (or sell). Even a minor price turn against the crowd triggers a cascade of stop-losses, creating an asymmetric Reversal Bias.

Monitor 52-Week Commercial Extremes (Smart Money Valuation):
Condition: Commercials Index hits $\ge 95\%$ (52-Week High) or $\le 5\%$ (52-Week Low).
Market Meaning: When Commercial hedgers reach a 52-week high in net buying ($\ge 95\%$), smart money signals the commodity is historically undervalued. When Commercials reach a 52-week low ($\le 5\%$—their largest short position in a year), they signal the asset is historically overpriced.

Spot Net Position Inflection Flips (Cycle Shifts):
Condition: Large Speculators Net Position crosses above 0 (FLIP LONG) or below 0 (FLIP SHORT).
Market Meaning: When hedge funds transition from a net-short posture to a net-long posture (or vice versa), it marks a major macro Inflection Point and the start of a new directional cycle.

Validate Trend Strength via Open Interest (Capital Flow):
Condition: Weekly OI>0 (Rising Open Interest) vs. Weekly OI<0 (Falling Open Interest).
Market Meaning: Rising OI confirms new money is committing to risk, validating a strengthening trend. Falling OI during a rally or sell-off warns that the move is weakening and driven by short covering or long liquidation rather than fresh accumulation.

Ride Trends in Neutral Markets (Trend Continuation):
Condition: All participant groups sit between $20\%$ and $80\%$ while Large Speculators expand their net position week-over-week.

Market Meaning: When positioning is in the neutral middle zone without a lopsided consensus, the risk of a crowded squeeze is low. Trend followers have a Green Light to Ride the Trend in the direction of Large Speculator flows.

3. How to Read the Chart Signals & On-Screen Readout

Green Shaded Background: Triggered when Speculators are washed out ($\le 20\%$) or Commercials hit a 52-week accumulation high ($\ge 95\%$). Marks high-probability macro bottoming and accumulation zones.

Red Shaded Background: Triggered when Speculators are overcrowded long ($\ge 80\%$) or Commercials hit a 52-week short hedging extreme ($\le 5\%$). Marks high-probability distribution and topping zones.

Green / Red Diamonds (FLIP LONG / FLIP SHORT): Plotted directly on the oscillator line when Large Speculators cross the net-zero contract line from net-short to net-long (or vice versa).
On-Screen Status Readout: Displays each participant group's Net Contracts, True Weekly Change (Weekly), 52-Week Index %, Position Status tag, Open Interest Fuel status, and the overarching Master Bias Verdict.

4. Step-by-Step Trading Playbook

Because the CFTC records positions as of Tuesday’s market close and publishes the report on Friday afternoon (3:30 PM EST), COT data is a structural macro compass, not an exact entry trigger. Follow this 3-step workflow to execute trades:

Step 1: Establish Your Weekly Directional Bias (Weekend / Monday Prep)

When Bias Shows BULLISH REVERSAL WARNING or ACCUMULATION: COMMERCIAL 52W LONG
EXTREME: Stop selling breakdowns. Prepare exclusively for long setups as smart money accumulates and speculative shorts are vulnerable to a squeeze.

When Bias Shows BEARISH REVERSAL WARNING or CAUTION: COMMERCIAL 52W SHORT EXTREME: Stop chasing breakouts at the highs. Tighten stops on existing longs and prepare for short reversal setups.

When Bias Shows BULLISH / BEARISH TREND (GREEN LIGHT TO RIDE): Focus on trend-continuation setups and buy/sell pullbacks in the direction of Large Speculator flows.

Step 2: Check Open Interest to Size Your Conviction

Bullish Bias + RISING OI (+New Money / Strong Trend): Institutional funds are actively adding fresh risk. You can hold for larger multi-week swing targets.

Bullish Bias + FALLING OI (Short Covering / Weakening): The price move is being fueled by bears buying back shorts rather than aggressive new buyers entering. Take profits more conservatively at major resistance levels.

Step 3: Execute Using Price Action on the Daily / 4-Hour Chart Never blindly buy or sell on Friday afternoon solely because the COT Index hit $95\%$ or $5\%$—crowded markets can stay extreme for several weeks. Always wait for price action confirmation:

For Bullish Reversal Edges: Wait for a Daily or 4H liquidity sweep of a prior swing low followed by a bullish Break of Structure (BOS), moving average reclaim, or high-volume bullish engulfing candle before entering long.

For Bearish Reversal Edges: Wait for a failed breakout (bull trap) above a key resistance high followed by a bearish Break of Structure (BOS) before entering short.

For Trend-Riding Signals (GREEN LIGHT TO RIDE): Enter on Daily/4H pullbacks into support or demand zones while Large Speculators continue adding net contracts week-over-week (Weekly>0).

5. Supported Auto-Detected Markets

You do not need to load futures charts to use this indicator. It automatically detects and maps the following Spot, CFD, and Futures tickers out of the box:

Precious Metals: Gold (XAUUSD, GOLD, GC1!, MGC1!), Silver (XAGUSD, SILVER, SI1!, SIL1!), Platinum (XPTUSD, PL1!), Palladium (XPDUSD, PA1!)

Base Metals & Energy: Copper (XCUUSD, COPPER, HG1!), WTI Crude Oil (USOIL, WTI, CL1!), Brent Crude (UKOIL, BRENT, BZ1!), Natural Gas (NATGAS, NG1!)

Agriculture & Softs: Corn (ZC1!), Soybeans (ZS1!), Wheat (ZW1!), Coffee (KC1!), Cocoa (CC1!), Sugar (SB1!)

Custom Markets: Enter any valid 6-digit CFTC Contract Market Code into the Manual CFTC Code Override field in the settings to analyze Forex pairs, stock indices, or Treasury rates.

免责声明

这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。