/ia-pinescript
Pine Script v6: syntax, performance, error diagnosis, backtesting, visualization. Use when writing or debugging `.pine` files or TradingView Pine indicators/strategies.
$ npx -y skills add iliaal/whetstone --skill ia-pinescript --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/ia-pinescript
Context preview
The summary Claude sees to decide when to auto-load this skill.
Pine Script v6: syntax, performance, error diagnosis, backtesting, visualization. Use when writing or debugging `.pine` files or TradingView Pine indicators/strategies.
SKILL.md
ia-pinescript.SKILL.mdname: ia-pinescript
class: language
description: >-
Pine Script v6: syntax, performance, error diagnosis, backtesting,
visualization. Use when writing or debugging `.pine` files or TradingView
Pine indicators/strategies.
paths: "**/*.pine"
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(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
Visualization
- `color.from_gradient()` for trend strength coloring
- Adaptive text sizing: `size.small` for intraday, `size.normal` for daily+
- Dynamic table rows -- resize based on enabled features via input toggles
- Professional color constants: define BULL_COLOR, BEAR_COLOR, NEUTRAL_COLOR once with transparency
Publishing
- Documentation goes at TOP of .pine file as comments before `indicator()`/`strategy()`
- Use `@version`, `@description`, `@param` tags
- Multi-line tooltips: `tooltip="Line 1" + "\n" + "Line 2"`
- **TradingView House Rules**: no financial advice, no performance guarantees, no external links, no obfuscated code, no donation requests
Common Coding Mistakes
- Indicator stacking (RSI + Stochastics + CCI) -- all measure the same thing (momentum). Use indicators from different categories instead.
- Overfitting parameters: if optimal values are oddly specific (RSI 23 instead of 20), the backtest is curve-fitted. Use round numbers and `input()` with sensible defaults.
- Missing `barstate.isconfirmed` guard -- calculations on unconfirmed bars cause repainting. Always guard entry signals.
- Hardcoded thresholds without `input()` -- makes the script untestable across instruments.
Workflow
1. Write indicator/strategy in Pine Editor 2. Test with bar replay and strategy tester on multiple timeframes 3. Walk-forward validate before trusting backtest results (see Strategy & Backtesting above) 4. Verify: run on 3+ symbols and 2+ timeframes
Verify
- Indicator compiles without errors on TradingView
- No repainting: `barstate.isconfirmed` guard present where needed
- Walk-forward tested on 3+ symbols across different timeframes
Read more
name: ia-pinescript class: language description: >- Pine Script v6: syntax, performance, error diagnosis, backtesting, visualization. Use when writing or debugging `.pine` files or TradingView Pine indicators/strategies. paths: "**/*.pine"
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(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
Visualization
- `color.from_gradient()` for trend strength coloring
- Adaptive text sizing: `size.small` for intraday, `size.normal` for daily+
- Dynamic table rows -- resize based on enabled features via input toggles
- Professional color constants: define BULL_COLOR, BEAR_COLOR, NEUTRAL_COLOR once with transparency
Publishing
- Documentation goes at TOP of .pine file as comments before `indicator()`/`strategy()`
- Use `@version`, `@description`, `@param` tags
- Multi-line tooltips: `tooltip="Line 1" + "\n" + "Line 2"`
- **TradingView House Rules**: no financial advice, no performance guarantees, no external links, no obfuscated code, no donation requests
Common Coding Mistakes
- Indicator stacking (RSI + Stochastics + CCI) -- all measure the same thing (momentum). Use indicators from different categories instead.
- Overfitting parameters: if optimal values are oddly specific (RSI 23 instead of 20), the backtest is curve-fitted. Use round numbers and `input()` with sensible defaults.
- Missing `barstate.isconfirmed` guard -- calculations on unconfirmed bars cause repainting. Always guard entry signals.
- Hardcoded thresholds without `input()` -- makes the script untestable across instruments.
Workflow
1. Write indicator/strategy in Pine Editor 2. Test with bar replay and strategy tester on multiple timeframes 3. Walk-forward validate before trusting backtest results (see Strategy & Backtesting above) 4. Verify: run on 3+ symbols and 2+ timeframes
Verify
- Indicator compiles without errors on TradingView
- No repainting: `barstate.isconfirmed` guard present where needed
- Walk-forward tested on 3+ symbols across different timeframes
A Claude Code plugin that makes AI coding agents follow engineering discipline. Plan before coding. Verify before claiming done. Find root cause before patching. Review before merge. Skills activate based on file type and task signals, not manual toggling.
Repo: iliaal/whetstone
Other skills on whetstone.
- /skill-distiller
Fetches top-rated skills from skills.sh, analyzes them, and synthesizes one token-efficient skill combining the best elements. Use when the user asks to "distill skills for X", "find and combine skills for X", "synthesize skills", "merge skills", "make a skill for X from
Open skill - /ia-agent-native-architecture
Design agent-native applications where agents replace UI users as the primary actor. Use when designing MCP tools, agent-loop architectures, system prompt design, hooks policy, shared-workspace file patterns, or self-modifying agent systems.
Open skill - /ia-brainstorming
Pre-implementation exploration: deep interview, approach comparison, design doc. Use when exploring a vague feature idea, clarifying ambiguous requirements, or comparing approaches before coding. For the full workflow, use the ia-brainstorm command (Claude Code).
Open skill - /ia-code-review
Structured code reviews with severity-ranked findings and deep multi-agent mode. Use when performing a code review, auditing code quality, or critiquing PRs, MRs, or diffs.
Open skill - /ia-compound-docs
Document solved problems for team reuse. Provides process knowledge for /ia-compound. Use when documenting a resolved issue, writing up lessons learned, capturing a post-mortem, adding to the knowledge base, or building searchable institutional knowledge after debugging.
Open skill - /ia-debugging
Systematic root-cause debugging with verification. Use for errors, stack traces, broken tests, flaky tests, regressions, or anything not working as expected. For validating bug reports before fixing, use bug-reproduction-validator agent.
Open skill

