← ClaudeAtlas

ia-pinescriptlisted

Pine Script v6: syntax, performance, error diagnosis, backtesting, visualization. Use when writing or debugging `.pine` files or TradingView Pine indicators/strategies.
iliaal/whetstone · ★ 20 · Code & Development · score 84
Install: claude install-skill iliaal/whetstone
# 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 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(b