Professional Pine Script v6 development environment for TradingView indicators and strategies.
Use these skills to get started:
/pinescript:start- Guided wizard for new projects/pinescript:create [description]- Quick creation from description/pinescript:video [youtube-url]- Analyze trading video/pinescript:templates- Browse templates/pinescript:examples- Browse examples
WRONG:
titleText = condition ? "value1" :
"value2" // ERROR!
CORRECT:
titleText = condition ? "value1" : "value2"
For expressions outside parentheses, continuation lines must use non-multiple-of-4 indentation:
longCondition = ta.crossover(ema50, ema200) and
rsi < 30 // 5 spaces - NOT multiple of 4
Use the pine_guide MCP tool with topic "language" for complete syntax rules.
NEVER use plot() inside local scopes (if, for, functions):
// ❌ WRONG
if condition
plot(value) // ERROR!
// ✅ CORRECT
plot(condition ? value : na)
For complex data, define User Defined Types before calculations:
- Bundle related data together
- Use
xloc.bar_timefor unlimited lookback (not bar_index which has 5000 bar limit) - Store both
timeandbar_indexwhen capturing events
projects/- Your Pine Script files (save work here)templates/- Ready-to-use templatesexamples/- Reference implementationsdocs/- Pine Script documentation + MCP servertools/- Development utilities
- Max 500 bars lookback
- Max 500 plot outputs
- Max 40 security() calls
- Max 64 drawing objects
- Strings: 40,960 characters
- Version Declaration: Always start with
//@version=6 - Strategy Alerts: Include
//@strategy_alert_message {{strategy.order.alert_message}}immediately after thestrategy()call (TradingView now rejects it above the declaration) - Avoid Repainting: Use
lookahead=barmerge.lookahead_offwithrequest.security() - Handle NA Values: Check with
na(value)before operations - Cache Loop Boundaries: Store
array.size()before loops (2025 breaking change) - Group Inputs: Use
group=parameter for organized settings - Add Tooltips: Help users understand each input
- No Unrequested Chrome: Do NOT add performance/stats tables or other decorative panels by default. Ship the core logic + requested visuals only; offer extras as a follow-up.
When given a YouTube URL, run the analyzer:
python tools/video-analyzer.py "URL"Then confirm the extracted strategy with the user before implementing.
Skills activate automatically based on context:
| Skill | Purpose |
|---|---|
| pine-developer | Write Pine Script code |
| pine-visualizer | Break down trading concepts |
| pine-debugger | Fix errors and add debugging |
| pine-backtester | Add performance metrics |
| pine-optimizer | Improve performance and UX |
| pine-publisher | Prepare for publication |
| pine-manager | Orchestrate complex projects |
Use the pinescript MCP server tools for documentation lookup:
pine_search- Full-text search across all Pine Script docspine_reference- Look up functions, variables, types (e.g.,ta.sma,plot)pine_guide- Retrieve guide pages by topic (execution model, strategies, plots)pine_examples- Find code examples with contextpine_categories- Browse documentation categories
Local docs are also available at:
docs/manual/- Complete Pine Script v6 referencedocs/docs/- User guide (concepts, language, FAQ, errors)
docs/pine-error-log.md is a running repository of real compilation errors, warnings,
and non-obvious techniques hit in this project. Check it before writing plots/panes/
strategy declarations, and append a new entry whenever you resolve a compiler error or
gotcha so the same mistake is never repeated. (E.g. it records that barcolor() has
no force_overlay arg, and how to combine a chart overlay + a pane oscillator in one
script.)
Before delivering code:
-
//@version=6present - No repainting (or documented)
- NA values handled
- Loop boundaries cached
- Inputs grouped with tooltips
- Strategy has alert annotation