Skip to content
All library documents

Building CFTC Commitment of Traders Requests with a Pine Library

Article TradingView scripts

Summary

This Pine library helps scripts construct and request Commitment of Traders data series. It maps report families, metric names, directions, options inclusion, and report types into ticker identifiers, then retrieves the selected series through a security request. Its supported measures cover open interest, trader counts, position categories, and concentration metrics across Legacy, Disaggregated, and Financial reports.

The library includes validation for invalid metric and direction combinations and raises an error when a requested series appears unavailable. An example plots Legacy open interest for the current symbol’s CFTC code. This is a data-access utility rather than a trading strategy: it explains how to request and display COT data but offers no signals, backtest, or evidence that any particular positioning measure predicts prices. Correct use depends on selecting a valid CFTC code and report configuration for the instrument.

Key ideas

  • The library translates COT report settings into ticker identifiers.
  • Requests can specify report family, options inclusion, metric, direction, and metric type.
  • Metric names and valid directions differ across report families.
  • The code validates incompatible settings and errors when requested data is unavailable.
  • The example plots open interest and does not define a trading signal.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.