OPEN-SOURCE SCRIPT

COT Index

774
COT Index — Managed Money / Large Spec / Commercials

Short tagline:
Three-line COT Index (0–100) for futures: Large Spec, Managed Money, Commercials. Min-max normalized over a configurable rolling weekly window.

---
Description:

The COT Index plots three trader-group positioning gauges on a single 0–100 scale, derived directly from the CFTC's weekly Commitments of Traders reports. Useful for spotting positioning extremes, divergences between speculator and
commercial flow, and contrarian setups.

# What it shows

Three colored lines:
- 🔵 **Large Speculator** — Managed Money + Other Reportable (combined non-commercial positioning)
- 🟣 **Managed Money** — Managed Money only (Disaggregated) or Leveraged Funds (Financial / TFF)
- 🟠 **Commercials** — Producer/Merchant (Disaggregated) or Dealer/Intermediary (Financial)

Plus reference levels:
- Dashed red at **90** — extreme long
- Dashed green at **10** — extreme short
- Dotted gray at **50** — mid

# Formula

For each group, the indicator computes net positioning (Long − Short), then min-max normalizes over a rolling N-week window:

COT Index = (currentNet − min(net, N)) / (max(net, N) − min(net, N)) × 100

Default N = 156 weeks (3 years). Other common values: 13 (3M), 26 (6M), 52 (1Y).

# Auto contract resolution

Apply to any of the supported futures contracts and the indicator auto-resolves the CFTC code from the chart symbol. No manual configuration needed.

| Asset | Symbol | Report |
|---|---|---|
| Gold | COMEX:GC1! | Disaggregated |
| Silver | COMEX:SI1! | Disaggregated |
| Copper | COMEX:HG1! | Disaggregated |
| Platinum | NYMEX:PL1! | Disaggregated |
| Palladium | NYMEX:PA1! | Disaggregated |
| WTI Crude Oil | NYMEX:CL1! | Disaggregated |
| Brent Crude Oil | NYMEX:BZ1! / ICEEUR:BRN1! | Disaggregated |
| Natural Gas | NYMEX:NG1! | Disaggregated |
| RBOB Gasoline | NYMEX:RB1! | Disaggregated |
| Heating Oil | NYMEX:HO1! | Disaggregated |
| Euro FX | CME:6E1! | Financial (TFF) |
| British Pound | CME:6B1! | Financial (TFF) |
| Swiss Franc | CME:6S1! | Financial (TFF) |
| Canadian Dollar | CME:6C1! | Financial (TFF) |
| Japanese Yen | CME:6J1! | Financial (TFF) |
| Australian Dollar | CME:6A1! | Financial (TFF) |
| New Zealand Dollar | CME:6N1! | Financial (TFF) |
| Mexican Peso | CME:6M1! | Financial (TFF) |

Apply to a non-mapped symbol (e.g. a stock) and the indicator returns a clear runtime error.

# Inputs

- **Lookback (weeks)** — rolling window (4–520, default 156)
- **Show Large Speculator / Managed Money / Commercials** — toggle each line independently
- **Extreme long / short thresholds** — adjust the dashed reference lines

# How to read it

- **Large Spec / Managed Money near 90+** → speculators are very long, often a contrarian sell signal
- **Large Spec / Managed Money near 10−** → speculators are very short, often a contrarian buy signal
- **Commercials are the inverse** of speculators by definition (they take the other side of the trade) — Commercials at 1 typically pairs with Specs near 100
- **Watch divergences** between price and the indicator — speculative positioning peaking while price still rises is a classic distribution warning

# Notes

- Uses TradingView's official `LibraryCOT` (by TradingView) for ticker construction.
- Forces weekly resolution regardless of chart timeframe — values only update on Tuesday COT release days.
- `lookahead = barmerge.lookahead_off` — no future data leak; backtesting is honest.
- Auto-detect requires applying to the **futures** symbol (e.g. `6E1!`), not the spot pair (`EURUSD`). Spot FX charts are not supported.
- Data comes from the Disaggregated report for metals/energy and the Traders in Financial Futures (TFF) report for FX. Both are futures-only (`includeOptions=false`).

# Credits

Data fetching: [LibraryCOT by TradingView](tradingview.com/script/ysFf2OTq-LibraryCOT/).

Open-source — feel free to fork and adapt.

---

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.