# pine-optimizer

A skill that rewrites Pine Script on TradingView: faster calculations, cleaner indicator settings, simpler code.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 460 installs · ★ 218
- Author: TradersPost
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/TradersPost/pinescript-agents/tree/HEAD/skills/pine-optimizer/SKILL.md
- Updated: 2026-07-23
- HTML: https://affpapa.org/en/nevibecode/skills/pine-optimizer

## What it does

The skill reads your Pine Script and rewrites it around newer language features. The core of it is UDT-first organisation: one array of a custom type instead of six parallel arrays that have to stay in sync. That kills the sync bugs and the `bar_index` clamping code along with them.

On the UI side it shows how the `active` parameter on `input.*` hides settings that do not apply to the current choice, and how to tuck a whole advanced block behind one checkbox. For drawing, built-in line styles replace hand-rolled visuals.

It works with `Read, Edit, Grep, Glob`, so it finds and edits files on its own. The skill recommends `xloc.bar_time` for lines because that mode has no historical buffer limit, which makes coordinate clamping unnecessary. If traditional `for` loops stay in the script, cache the boundary with `array.size()` before the loop — the array can change mid-iteration otherwise.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add TradersPost/pinescript-agents --skill pine-optimizer -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/pine-optimizer/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/pine-optimizer/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add TradersPost/pinescript-agents --skill pine-optimizer -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/pine-optimizer/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add TradersPost/pinescript-agents --skill pine-optimizer -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/pine-optimizer/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install TradersPost/pinescript-agents pine-optimizer
```

2. **Manually: put the files in place**
- File: `.github/skills/pine-optimizer/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add TradersPost/pinescript-agents --skill pine-optimizer -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/TradersPost/pinescript-agents --path skills/pine-optimizer
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/pine-optimizer/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add TradersPost/pinescript-agents --skill pine-optimizer -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/TradersPost/pinescript-agents/tree/HEAD/skills/pine-optimizer/SKILL.md

## When to use it
- drop parallel arrays and keep related data in one type
- hide indicator inputs that do not apply to the selected mode
- remove `bar_index` clamping when drawing lines over history
- fold repeated drawing blocks into a single type method
- swap manual line styling for built-in `plot.linestyle_*`

## Example prompts
- Rewrite this indicator with UDTs: no parallel arrays, drawing moved into a type method.
- Hide the length inputs with `active` so they only show for the Custom mode.
- Check the `for` loops and cache the array bounds before iterating.

## Similar
- [cost-latency-optimizer](https://affpapa.org/en/nevibecode/skills/cost-latency-optimizer.md) — skill · 322 installs
- [vault-optimizer](https://affpapa.org/en/nevibecode/agents/vault-optimizer.md) — subagent · 727 installs
- [database-cloud-optimization-database-optimizer](https://affpapa.org/en/nevibecode/agents/database-cloud-optimization-database-optimizer.md) — subagent · ★ 41729
- [tradingview-quantitative](https://affpapa.org/en/nevibecode/skills/tradingview-quantitative.md) — skill · 1500 installs
- [tradingview-reader](https://affpapa.org/en/nevibecode/skills/tradingview-reader.md) — skill · 1100 installs
- [m10-performance](https://affpapa.org/en/nevibecode/skills/m10-performance.md) — skill · 3600 installs

From the same set: [traderspost/pinescript-agents](https://affpapa.org/en/nevibecode/by/traderspost/pinescript-agents.md) — 5 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
