Skip to content

Reading Custom Pine Output

tradesdontlie edited this page Jul 21, 2026 · 1 revision

Reading Custom Pine Output

This is the bridge's signature capability, and the reason it beats screenshot-scraping. Custom Pine Script indicators draw their own graphics — horizontal levels, text labels, tables, and boxes — using line.new(), label.new(), table.new(), and box.new(). None of that shows up in normal price or study-value APIs. This family of tools reaches into TradingView's internal graphics collection and reads it back as structured data.

So when a user asks "what levels is my Profiler indicator showing?" the agent gets real numbers, not a guess from pixels.

The four tools

Tool Reads Returns
data_get_pine_lines line.new() Horizontal price levels, deduplicated, sorted high→low
data_get_pine_labels label.new() Text + price pairs (e.g., "PDH 24550") — capped at 50/study by default
data_get_pine_tables table.new() Table cells as formatted rows (session stats, analytics dashboards)
data_get_pine_boxes box.new() Deduplicated {high, low} price zones

The one rule that matters

The indicator must be VISIBLE on the chart. If it's hidden, TradingView doesn't compute its graphics, and these tools return nothing. Toggle it on with indicator_toggle_visibility if needed.

Always pass study_filter

When you know which indicator you want, pass study_filter with a name substring. This targets one study instead of scanning every study on the chart — faster, and far smaller output.

data_get_pine_lines   study_filter: "Profiler"
data_get_pine_labels  study_filter: "Profiler"
data_get_pine_tables  study_filter: "Profiler"

Typical flow

1. chart_get_state                              # find the study name / entity ID
2. data_get_pine_lines   study_filter: "Profiler"   # price levels
3. data_get_pine_labels  study_filter: "Profiler"   # labeled context ("Settlement", "ASN O/U")
4. data_get_pine_tables  study_filter: "Profiler"   # the analytics table
5. capture_screenshot                           # visual cross-check

What you get back

  • Lines → clean, deduplicated price levels (multiple line.new() calls at the same price collapse to one), sorted high→low, so an agent can reason about support/resistance directly.
  • Labels → the human-readable annotations the indicator authors intended — text and the price they're anchored to. This is where semantic context lives ("PDH", "Bias Long ✓", "Settlement").
  • Tables → dashboards flattened into rows you can read or re-tabulate.
  • Boxes{high, low} zones for supply/demand, value areas, ranges.

Verbose mode (rarely needed)

By default these tools return compact, deduplicated data. Pass verbose: true only if you specifically need raw drawing data with IDs, colors, and coordinates. Don't do this casually — it's much larger. See Context Management.

Under the hood

The graphics live deep in TradingView's model. The bridge walks:

study._graphics._primitivesCollection.dwglines.get('lines').get(false)._primitivesDataById

...and the equivalent collections for labels, tables, and boxes, then normalizes and deduplicates them. More on the internals in Architecture Internals.


See also: Agent Workflows ("What levels/lines/labels are showing?") · Tool Reference (Pine Graphics Extraction).

Clone this wiki locally