pinescript

pinescript is a skill for Claude Code from iliaal/ai-skills. It costs 40 tokens per session (1,425 once invoked), scanned A, original, MIT.

A set of guidance for writing and debugging Pine Script v6, the programming language used for TradingView indicators and trading strategies.

In plain words
What is it for?
Use it to create or troubleshoot TradingView indicators, strategies, backtests, and chart visualizations.
Why use it?
It helps avoid Pine Script syntax errors, repainting, invalid plotting patterns, and platform limit problems.

Skill for Claude Code

Written for Claude Code: paths in frontmatter.

Good fit Use it to create or troubleshoot TradingView indicators, strategies, backtests, and chart visualizations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/iliaal/ai-skills/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/ai-skills --skill pinescript
Clone the repo
git clone --depth 1 https://github.com/iliaal/ai-skills

Made for: Claude Code.

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/ai-skills/pinescript.svg)](https://agentmods.dev/skills/iliaal/ai-skills/pinescript)
Your own site
<a href="https://agentmods.dev/skills/iliaal/ai-skills/pinescript"><img src="https://agentmods.dev/badge/skills/iliaal/ai-skills/pinescript.svg" alt="Measured on agentmods" height="20"></a>
Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,425 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.00040 $0.01425
Opus 5 $0.00020 $0.00713
Sonnet 5 $0.00008 $0.00285
Haiku 4.5 $0.00004 $0.00143

Measured 8d ago against content hash bff20c784565, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-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 8d 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.

skills/pinescript/SKILL.md · 93 lines

How it starts

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

Pine Script Development

Verify before implementing: For Pine Script version-specific syntax or new built-in functions, look up current docs via Context7 (query-docs) before writing code. TradingView updates Pine Script frequently and training data may be stale.

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 outside parentheses MUST be indented by a non-multiple of 4 -- same indentation as the start errors, and 4/8/12 spaces parse as a local block and error too (2 spaces is the conventional choice). Inside parentheses (function calls, parenthesized expressions) any indentation works, including multiples of 4
  • 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

  • Drawings positioned with xloc.bar_index reach at most 9,999 bars into the past and 500 into the future; for anything older, switch the drawing to xloc.bar_time and pass a timestamp (a time value without xloc.bar_time is treated as a future bar index and errors)
  • Cap drawing growth with a rolling buffer: push each new object into an array, then line.delete(arr.shift()) once arr.size() exceeds the intended count -- otherwise the oldest drawings silently vanish at the 64-object limit

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
  • Iterate collections with for item in myArray (or for [i, item] in myArray) instead of for i = 0 to array.size(...) - 1 -- the indexed form re-evaluates the bound each pass and breaks when the loop mutates the array's size
  • Model related values as a user-defined type, not parallel arrays: type Trade with float entry, int startBar, plus method functions, stored in one array<Trade>. Parallel arrays (entries, startBars, ...) desync on any missed push/remove and every operation must be repeated per array; one typed array keeps each object's fields together

Read the full file on GitHub · 93 lines

Files

What ships with it

2 files 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. 8d ago First seen · 93 lines · 40 tokens per session scan A bff20c784565

Subscribe to this mod's changes

pinescript is a skill published in the GitHub repository iliaal/ai-skills (41 stars, last pushed yesterday), licensed MIT. It adds 40 tokens to every session and 1,425 once invoked, about $0.0002 per session on Opus 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

alpha-evaluate

A multi-step workflow for testing an investment factor, meaning a measurable stock signal, against market data. It examines predictive relationship, grouped returns, risk-adjusted results, consistency, and robustness.

VernonOY/alpha-skills · 74 tokens

alpha-backtest

A strategy backtesting workflow that tests factor-based stock portfolios on historical data. Backtesting means simulating how a strategy would have performed in the past.

VernonOY/alpha-skills · 56 tokens

alpha-mine

An automated process for proposing and testing stock-market formulas, called factors, that combine price or trading data with mathematical operations. It screens the candidates using measures such as IC, which compares a factor with later returns.

VernonOY/alpha-skills · 73 tokens

alpha-autopilot

An automated research loop for investment factors, which are measurable signals used to select or compare stocks. It finds candidates, tests them, records successful ones, monitors active factors, and retires those that weaken.

VernonOY/alpha-skills · 85 tokens

alpha-library

A manager for a quantitative-finance factor library, where factors are measurable signals used to study or select investments. It stores a registry of factors in a SQLite database and supports several stock markets through data adapters.

VernonOY/alpha-skills · 55 tokens

alpha-monitor

A monitoring tool for investment factors, which are measurable signals used to select or rank stocks. It checks whether active factors are losing effectiveness or showing health problems across supported stock markets.

VernonOY/alpha-skills · 56 tokens