pinescript

pinescript is a skill for Claude Code, Codex from iliaal/whetstone. It costs 64 tokens per session (912 once invoked), scanned A, original, MIT.

A reference guide for Pine Script version 6, the programming language used to create TradingView indicators and trading strategies.

In plain words
What is it for?
Use it to build indicators or strategies, fix Pine code, improve script performance, and reduce errors such as repainting or invalid plotting.
Why use it?
It helps avoid common language errors and work within TradingView's limits when writing, debugging, visualizing, or backtesting scripts.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to build indicators or strategies, fix Pine code, improve script performance, and reduce errors such as repainting or invalid plotting.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/iliaal/whetstone/pinescript
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add iliaal/whetstone --skill pinescript
Clone the repo
git clone --depth 1 https://github.com/iliaal/whetstone

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pinescript

README.md
[![agentmods](https://agentmods.dev/badge/skills/iliaal/whetstone/pinescript/github.svg)](https://agentmods.dev/skills/iliaal/whetstone/pinescript)
Your own site
<a href="https://agentmods.dev/skills/iliaal/whetstone/pinescript"><img src="https://agentmods.dev/badge/skills/iliaal/whetstone/pinescript/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pinescript

Your own site · 80×15
<a href="https://agentmods.dev/skills/iliaal/whetstone/pinescript"><img src="https://agentmods.dev/badge/skills/iliaal/whetstone/pinescript.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 64 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 912 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00064 $0.00912
Opus 5.5 $0.00026 $0.00365
Sonnet 5.5 $0.00013 $0.00182
Haiku 4.5 $0.00006 $0.00091

Measured 1mo ago against content hash ac71ebe96884, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

pinescript scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

distillery/generated-skills/pinescript/SKILL.md · 71 lines

How it starts

The opening of the file, as written. The whole thing — 71 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Pine Script Development

Critical Syntax Rules

  • Ternary operators MUST stay on one line — splitting across lines causes "end of line without line continuation" error. For complex ternaries, use intermediate variables:
    isBull = close > open
    barColor = isBull ? color.green : color.red
    
  • Continuation lines MUST be indented MORE than the starting line — same indentation = error
  • NEVER use plot() inside local scopes (if/for/functions) — use conditional value instead: plot(condition ? value : na)
  • barstate.isconfirmed — use to prevent repainting on real-time bars

Platform Limits

500 bars history for request.security() | 500 plot calls | 64 drawing objects | 40 request.security() calls | 100KB compiled size

Performance

  • Tuple security calls — one request.security() returning [close, high, low] instead of 3 separate calls
  • Pre-allocate arrays with array.new<type>(size) instead of push-and-resize
  • Short-circuit signals: build conditions incrementally, exit early when first condition fails
  • Cache repeated calculations in variables — Pine recalculates every bar

Debugging

TradingView has no console or debugger. Use these patterns:

  • Label debugging: label.new(bar_index, high, str.tostring(myVar)) to inspect values
  • Table monitor: table.new() with barstate.islast for real-time variable dashboard
  • Debug mode toggle: wrap all debug code in if input.bool("Debug", false) — remove before publishing
  • Repainting detector: track previousValue = value[1], flag when historical values change

Strategy & Backtesting

  • Use strategy.* functions: strategy.wintrades, strategy.losstrades, strategy.grossprofit
  • Drawdown tracking: maxEquity = math.max(strategy.equity, nz(maxEquity[1])), then dd = (maxEquity - strategy.equity) / maxEquity * 100
  • Sharpe: dailyReturn * 252 / (stdDev * math.sqrt(252))
  • Walk-forward validation — optimize on period 1, test on period 2, re-optimize on period 2, test on period 3. If metrics degrade > 30%, parameters are overfit.
  • Indicator accuracy testing — use forward-looking close[lookforward] to measure prediction accuracy, track true/false positive rates

Read the full file on GitHub · 71 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 71 lines · 64 tokens per session scan A ac71ebe96884

Subscribe to this mod's changes

pinescript is a skill published in the GitHub repository iliaal/whetstone (35 stars, last pushed yesterday), licensed MIT. It adds 64 tokens to every session and 912 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

r-tidyverse-style

Use when the user asks to review or clean up R code for tidyverse style, standardize formatting or names, remove redundant comments or wrappers, or make a behavior-preserving style pass. Also use when writing substantial new R package code if the user requests tidyverse style or the package already follows it. Not for…

posit-dev/skills · 83 tokens

product-economics

Does this product make money at a price someone will pay? Forces contribution margin, a price with a stated basis, and a bottom-up market size — each number labelled measured / assumed / unknown, so a guess can never be read as a calculation.

avelikiy/great_cto · 55 tokens

triage

Triages a PR comment — from a bot (Copilot, CI) or a human reviewer. Routes to the triagehelper.py helper for identity checks, thread snapshotting, isolated-worktree fixes, and publish/reply/resolve mechanics; you classify the finding and apply a justified fix. --dry-run is fully read-only (investigation and a printed…

nitinjain999/platform-skills · 109 tokens

pr-review

Comprehensive PR review across six dimensions — cost impact, environment drift, ownership gaps, SOC 2 compliance, deprecated API / version hygiene, and rollback feasibility. Each mode inspects the diff and current file state, reports findings with severity, and recommends concrete fixes. Use when preparing a PR for…

nitinjain999/platform-skills · 81 tokens

shared-tooling-eslint-prettier

ESLint 9/10 flat config with defineConfig(), Prettier v3.0+ shared config, eslint-config-prettier integration, typescript-eslint v8+ projectService.

agents-inc/skills · 46 tokens

ts-review

A TypeScript code-review skill for projects that keep multiple packages in one repository. Such a repository is called a monorepo.

liuyanghejerry/Clausura · 26 tokens