OPEN-SOURCE SCRIPT
Mis à jour COT Index

Reference:
Trade Stocks and Commodities with the Insiders
Secrets of the COT Report by Larry Williams pg34
The equation is as below:
Current week's value- Lowest value of last three years
---------------------------------------------------------------------------- X 100%
Highest high of last three years-Lowest low of last three years
According to Larry Williams, traders should follow commercials direction. When the commercial index line (yellow line) is above 80, this indicates commercials are bullish. Hence, traders can look for potential buy setup. Conversely, when commercials index line (yellow line) is below 20, this indicates commercials are bearish, we can look for sell setup.
Do note that this is only applicable on Weekly chart as COT reports come out on weekly basis.
Modification from the original COT index from Larry Williams:
1) I've added 1year and 6months period, so traders maybe can look for pullback using shorter period. By default, Larry Williams uses 3 years Commercial index.
2) I've added non-commercials and retail traders index, they basically trade opposite way of commercials.
This indicator should not be used as a timing tool or entry tool, you can use it as your weekly or monthly bias tool. For more information, please read the books. Feel free to modify the code, if u have a better version of this, you may share to me if you want, I will be very grateful!
Trade Stocks and Commodities with the Insiders
Secrets of the COT Report by Larry Williams pg34
The equation is as below:
Current week's value- Lowest value of last three years
---------------------------------------------------------------------------- X 100%
Highest high of last three years-Lowest low of last three years
According to Larry Williams, traders should follow commercials direction. When the commercial index line (yellow line) is above 80, this indicates commercials are bullish. Hence, traders can look for potential buy setup. Conversely, when commercials index line (yellow line) is below 20, this indicates commercials are bearish, we can look for sell setup.
Do note that this is only applicable on Weekly chart as COT reports come out on weekly basis.
Modification from the original COT index from Larry Williams:
1) I've added 1year and 6months period, so traders maybe can look for pullback using shorter period. By default, Larry Williams uses 3 years Commercial index.
2) I've added non-commercials and retail traders index, they basically trade opposite way of commercials.
This indicator should not be used as a timing tool or entry tool, you can use it as your weekly or monthly bias tool. For more information, please read the books. Feel free to modify the code, if u have a better version of this, you may share to me if you want, I will be very grateful!
Notes de version
Now available more futures chartNotes de version
# COT Index Indicator - Update Notes## Version 2.0 - Bug Fixes & Data Consistency Improvements
### Bug Fixes
- Fixed syntax error: "end of line without line continuation" in multi-line string concatenation
- Resolved indentation issues with Pine Script line continuation rules
- Corrected data inconsistencies from automatic CFTC code detection
### Major Changes
- **Manual CFTC Code Mapping**: Switched from automatic detection to manual mapping to ensure data accuracy and consistency
- **Verification Table**: Added optional data table showing current week's Commercial Long, Short, and Net Position values
- **CFTC Code Display**: Table now shows which CFTC code is being used for transparency
### Supported Symbols
Please use **ONLY** the official CME/COMEX/CBOT/NYMEX futures symbols listed below:
#### **Metals** (COMEX)
- `GC` - Gold
- `SI` - Silver
- `HG` - Copper
- `PL` - Platinum
- `PA` - Palladium
#### **Energy** (NYMEX)
- `CL` - Crude Oil WTI
- `NG` - Natural Gas
- `RB` - RBOB Gasoline
- `HO` - Heating Oil
#### **Equity Indices** (CME)
- `ES` - E-mini S&P 500
- `NQ` - E-mini NASDAQ-100
- `YM` - E-mini Dow Jones
- `RTY` - E-mini Russell 2000
- `NIY` / `NKD` - Nikkei 225
#### **Currencies** (CME)
- `6E` - Euro FX
- `6B` - British Pound
- `6J` - Japanese Yen
- `6A` - Australian Dollar
- `6C` - Canadian Dollar
- `6S` - Swiss Franc
- `6N` - New Zealand Dollar
- `6M` - Mexican Peso
- `DX` - U.S. Dollar Index
*Note: Spot forex pairs (EURUSD, GBPUSD, etc.) are supported and will automatically map to their futures equivalents*
#### **Grains** (CBOT)
- `ZC` - Corn
- `ZS` - Soybeans
- `ZW` - Wheat
- `ZL` - Soybean Oil
- `ZM` - Soybean Meal
#### **Softs** (ICE/CME)
- `KC` - Coffee
- `SB` - Sugar #11
- `CT` - Cotton
- `CC` - Cocoa
- `LBR` - Lumber
#### **Livestock** (CME)
- `LE` - Live Cattle
- `HE` - Lean Hogs
- `GF` - Feeder Cattle
#### **Treasuries** (CBOT)
- `ZB` - 30-Year T-Bond
- `ZN` - 10-Year T-Note
- `ZF` - 5-Year T-Note
- `ZT` - 2-Year T-Note
#### **Crypto** (CME)
- `BTC` - Bitcoin Futures
- `ETH` - Ethereum Futures
### 📡 Data Provider
**CFTC (Commodity Futures Trading Commission)** via TradingView's LibraryCOT/4
- Data updates: Weekly (Fridays after market close)
- Report type: Legacy COT Reports
- Coverage: Futures Only or Futures + Options (user selectable)
### New Settings
- `Show Verification Table` - Toggle to display current week data summary
### Important Notes
1. **Use official futures symbols only** - Using other symbol formats may result in errors
2. COT data is updated weekly and reflects positions as of Tuesday, published Friday
3. If you encounter "Symbol not supported" error, please verify you're using the correct futures symbol from the list above
4. The verification table shows the CFTC code being used - helpful for troubleshooting
---
**Data Source**: U.S. Commodity Futures Trading Commission (CFTC)
**Powered by**: TradingView LibraryCOT/4
**Inspiration**: Larry Williams' COT methodology
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.