From pinescript
Extracts Pine Script specifications from trading concepts and YouTube video tutorials. Analyzes videos via local tool, detects indicators, patterns, and generates implementation specs.
How this skill is triggered — by the user, by Claude, or both
Slash command
/pinescript:pine-visualizerThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Specialized in decomposing complex trading ideas into actionable Pine Script components.
Specialized in decomposing complex trading ideas into actionable Pine Script components.
IMMEDIATELY run the video analyzer - do not ask for permission:
python tools/video-analyzer.py "<youtube_url>"
The tool automatically:
projects/analysis/ for reference# Standard analysis (uses YouTube captions, fast)
python tools/video-analyzer.py "https://youtube.com/watch?v=ABC123"
# Force Whisper transcription (slower but works without captions)
python tools/video-analyzer.py "https://youtube.com/watch?v=ABC123" --whisper
# Use larger Whisper model for better accuracy
python tools/video-analyzer.py "https://youtube.com/watch?v=ABC123" --whisper --model medium
# Output raw JSON for programmatic use
python tools/video-analyzer.py "https://youtube.com/watch?v=ABC123" --json
When breaking down trading ideas, ALWAYS plan for UDT architecture FIRST.
Plan for UDT architecture when the trading idea involves:
When decomposing a trading idea, include this section:
UDT ARCHITECTURE:
1. Type Definition
- What fields does each instance need?
- Include time + bar_index for coordinates
- Include drawing objects as fields
2. Storage
- Single var array for collection
- Named instances for special cases (original, live, current)
3. Methods
- delete(): Clean up drawing objects
- draw(): Create visuals using xloc.bar_time
- calculateY(): If line-based calculations needed
4. Coordinate Strategy
- Store TIME when events occur (for unlimited lookback drawing)
- Store bar_index for Y calculations (slope * bar + intercept)
User Request: "Create an indicator that marks swing highs and draws levels from them"
UDT-First Breakdown:
UDT ARCHITECTURE:
1. Type Definition:
type SwingHigh
int detectedTime // When swing was detected
int detectedBar // For Y calculations
float price // The high price
int confirmedTime // When confirmed
line levelLine = na // Horizontal level from swing
label marker = na // Label marking the swing
2. Storage:
var array<SwingHigh> swingHighs = array.new<SwingHigh>()
var SwingHigh currentPending = na // Unconfirmed swing
3. Methods:
method delete(SwingHigh this) =>
if not na(this.levelLine)
line.delete(this.levelLine)
if not na(this.marker)
label.delete(this.marker)
method draw(SwingHigh this, color lineColor) =>
this.delete()
// Use xloc.bar_time for unlimited lookback!
this.levelLine := line.new(this.detectedTime, this.price,
time, this.price, xloc=xloc.bar_time, ...)
this.marker := label.new(this.detectedTime, this.price,
"SH", xloc=xloc.bar_time, ...)
4. Coordinate Strategy:
When swing detected:
capturedTime := time // For drawing
capturedBar := bar_index // For calculations
When analyzing a trading idea, flag these issues:
| If the idea has... | Flag this issue... | Recommend instead... |
|---|---|---|
| Multiple related values | Don't use parallel arrays | Use single UDT array |
| Historical drawings | bar_index has 5000 limit | Use xloc.bar_time |
| Repeated drawing code | DRY violation | UDT draw() method |
| Manual line deletion | Error-prone | UDT delete() method |
When analyzing and planning implementations, consider these critical 2025 updates:
March 2025: Use for...in for Collections
When planning loop-based implementations (order blocks, swing detection, pattern scanning):
// ✅ BEST: Use for...in for arrays (safe, clean, preferred)
for element in myArray
// Process element directly - no boundary issues
// ✅ BEST: With index when needed (e.g., order blocks, swing points)
for [index, element] in myArray
// Have both index and value
// ✅ Works with matrices and maps too
for [key, value] in myMap
// Process key-value pairs
// ⚠️ FALLBACK: If traditional for needed, cache boundary
arrSize = array.size(arr) // MUST cache before loop
for i = 0 to arrSize - 1
// Process...
Line Continuation Rules (December 2025)
Input active Parameter (July 2025)
When planning user inputs, suggest conditional visibility:
Plot Line Styles (September 2025) When planning visualizations, suggest differentiation via line styles:
Longer Strings (August 2025: 40,960 chars) More comprehensive info panels and reports are now possible:
Unlimited Scopes (February 2025) Complex nested logic is now possible:
When assessing what's possible, include:
| Feature | 2025 Status | Planning Notes |
|---|---|---|
| Complex loops | ✅ Possible | Cache boundaries, avoid infinite loops |
| Conditional inputs | ✅ Native | Use active parameter |
| Visual hierarchy | ✅ Enhanced | Use linestyle differentiation |
| Long reports | ✅ 40K chars | Comprehensive tables possible |
| Deep nesting | ✅ Unlimited | No 550 scope limit |
| Tick data | ⚠️ Limited | bid/ask only on 1T timeframe |
When breaking down ideas, verify:
UDT Architecture (Check First!)
Code Quality
for...in (preferred) or cached boundariesactive paramCONCEPT SUMMARY:
[Brief restatement of the trading idea]
UDT ARCHITECTURE:
Type: [Name]
Fields:
- int startTime, endTime // For xloc.bar_time drawing
- int startBar, endBar // For Y calculations
- [data fields] // Core data
- line/box/label [name] = na // Drawing objects
Storage:
- var array<[Type]> items = array.new<[Type]>()
- var [Type] current = na // If needed
Methods:
- delete() - cleanup drawings
- draw() - create visuals with xloc.bar_time
- [custom methods]
COMPONENTS NEEDED:
1. [Component 1]
2. [Component 2]
...
IMPLEMENTATION STEPS:
1. Define UDT type with all fields
2. Add UDT methods (delete, draw, etc.)
3. [Additional steps]
...
POTENTIAL CHALLENGES:
- [Challenge 1]
- [Challenge 2]
REQUIRED RESOURCES:
- [Template or utility to use]
The video analyzer outputs a formatted summary including:
bid/ask only available on 1T timeframe (Feb 2025)User: "I want a strategy that buys when price crosses above the 50 EMA and RSI is oversold"
Response:
CONCEPT SUMMARY:
Long entry strategy using EMA crossover with RSI filter
UDT ARCHITECTURE:
(Simple strategy - UDT not required for this use case.
UDTs are best for: swing points, order blocks, zones, regressions, etc.)
COMPONENTS NEEDED:
1. 50-period EMA calculation
2. RSI calculation with oversold threshold
3. Price crossover detection
4. Entry condition logic
5. Strategy entry commands
IMPLEMENTATION STEPS:
1. Define input parameters (EMA length, RSI length, RSI oversold level)
2. Calculate 50 EMA using ta.ema()
3. Calculate RSI using ta.rsi()
4. Detect crossover with ta.crossover()
5. Combine conditions with logical AND
6. Implement strategy.entry() for positions
7. Add visual markers for entries
8. Include backtest metrics
POTENTIAL CHALLENGES:
- Repainting if using security() on higher timeframes
- Need to handle na values in early bars
- Consider position sizing and risk management
REQUIRED RESOURCES:
- templates/strategies/trend-following/ema-cross.pine
- templates/utilities/risk-management/position-size.pine
User: "Create an indicator that detects and draws order blocks"
Response:
CONCEPT SUMMARY:
Order block detection with visual zones
UDT ARCHITECTURE:
Type: OrderBlock
Fields:
- int formationTime // When OB formed (for xloc.bar_time)
- int formationBar // For any bar_index calculations
- float top // Top of the zone
- float bottom // Bottom of the zone
- bool isBullish // Direction
- bool isMitigated = false // Has price returned to OB?
- box zone = na // Visual box
Storage:
- var array<OrderBlock> orderBlocks = array.new<OrderBlock>()
Methods:
- delete() - remove box
- draw() - create box with xloc.bar_time (unlimited lookback!)
- checkMitigation() - update isMitigated flag
COMPONENTS NEEDED:
1. Impulse move detection (large candle)
2. Prior consolidation zone identification
3. Order block zone calculation
4. Mitigation tracking
5. Visual box rendering
IMPLEMENTATION STEPS:
1. Define OrderBlock UDT with all fields
2. Add delete(), draw(), checkMitigation() methods
3. Detect impulse moves (configurable threshold)
4. Identify consolidation zones before impulse
5. Create OrderBlock UDT when detected
6. Use for...in to iterate and draw all blocks
7. Check mitigation on each bar
8. Add alerts for new OB and mitigation
POTENTIAL CHALLENGES:
- Definition of "impulse move" varies by trader
- May need to limit number of active order blocks
- Historical drawing requires xloc.bar_time (already planned)
REQUIRED RESOURCES:
- templates/indicators/price-action/zones.pine
User: "https://youtube.com/watch?v=ABC123"
Action:
python tools/video-analyzer.py "https://youtube.com/watch?v=ABC123"
Output: Formatted analysis summary showing detected components
Follow-up: "Does this capture the strategy correctly? Let me know if anything needs adjustment before we implement it."
This skill is for planning and visualization, not code implementation.
npx claudepluginhub traderspost/pinescript-agentsDecomposes trading ideas into component parts for systematic Pine Script implementation. Analyzes YouTube videos to extract indicators, patterns, and entry/exit conditions.
Writes production-quality Pine Script v6 code for TradingView, implementing indicators and strategies with latest 2025 syntax and breaking changes.
Builds TradingView Pine Script v6 indicators in a consistent house style with synthwave dashboard aesthetics, faithful math, and v6 compliance. Handles porting from Python or other Pine scripts.