Skip to content

Claude Code plugin marketplace for trading indicator development (Pine Script, NinjaScript, Tradovate)

Notifications You must be signed in to change notification settings

lgbarn/trading-indicator-plugins

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Trading Indicators Plugin for Claude Code

A Claude Code plugin for AI-powered trading indicator development across TradingView (Pine Script), NinjaTrader (NinjaScript), and Tradovate (JavaScript).

Version: 1.0.0 | Author: Luther Barnum


Overview

This plugin provides 33 specialized commands, 10 AI agents, and 3 pattern libraries for developing trading indicators across three major platforms:

Platform Language Commands
TradingView Pine Script v5/v6 11
NinjaTrader 8 NinjaScript (C#) 11
Tradovate JavaScript 11

Key Features

  • Create new indicators with proper structure and conventions
  • Convert indicators between platforms automatically
  • Validate syntax against official documentation
  • Debug runtime errors with platform-specific guidance
  • Refactor code for better organization and performance
  • Document indicators with auto-generated README files

Installation

Option 1: Clone and Install

# Clone the repository
git clone https://github.com/lgbarn/trading-indicator-plugins.git

# Add to Claude Code plugins
claude plugins add ./trading-indicator-plugins

Option 2: Direct Install from GitHub

claude plugins add github:lgbarn/trading-indicator-plugins

Verify Installation

claude plugins list

You should see trading-indicators in the list.


Quick Start

Create a New Pine Script Indicator

/trading-indicators:pine:new-indicator MyVWAP --v6

Convert Pine Script to NinjaScript

/trading-indicators:pine:convert LB_MyVWAP.pine --to ninja

Add Features to an Existing Indicator

/trading-indicators:ninja:add-feature MyVWAPLB.cs "VWAP bands with 2SD"

Validate Indicator Syntax

/trading-indicators:tradovate:validate MyIndicatorLB.js

Commands Reference

All three platforms share the same 11 commands. Invoke them using:

/trading-indicators:<platform>:<command> [arguments]

Where <platform> is pine, ninja, or tradovate.

Command Summary

Command Arguments Description
new-indicator <name> [--v5|--v6] Create a new indicator from scratch
add-feature <file> <feature> Add functionality to existing indicator
validate <file> Check syntax against official docs
test <file> [--validate|--logic] Validate structure and calculation logic
debug <file> [--error <msg>] Troubleshoot runtime errors
explain <file> Analyze and explain what indicator does
convert <file> --to <platform> Translate to another platform
compare <file1> <file2> Compare indicators or versions
refactor <file> [--organize|--optimize] Improve code organization
cleanup <file> Remove unused code, fix formatting
document <file> [--format md|inline] Generate documentation

Detailed Command Reference

new-indicator - Create New Indicator

Creates a new indicator with proper file structure, headers, and organization.

Pine Script:

/trading-indicators:pine:new-indicator SessionVWAP --v6

Creates LB_SessionVWAP.pine with Pine Script v6 structure.

NinjaScript:

/trading-indicators:ninja:new-indicator SessionVWAP

Creates SessionVWAPLB.cs with proper C# namespace and lifecycle methods.

Tradovate:

/trading-indicators:tradovate:new-indicator SessionVWAP

Creates SessionVWAPLB.js with proper exports and class structure.


add-feature - Enhance Existing Indicator

Adds new functionality to an existing indicator file.

Supported Features:

  • Price levels: VWAP bands, Initial Balance extensions, Pivot Points
  • Visual elements: Labels, background shading, candle coloring
  • Calculations: TWAP, standard deviation bands, session detection
  • Interactivity: Alert conditions, feature toggles, theme switching

Example:

/trading-indicators:pine:add-feature LB_MyVWAP.pine "2SD and 3SD bands"

convert - Cross-Platform Translation

Converts an indicator from one platform to another.

Example - Pine to NinjaScript:

/trading-indicators:pine:convert LB_MyVWAP.pine --to ninja

Example - NinjaScript to Tradovate:

/trading-indicators:ninja:convert MyVWAPLB.cs --to tradovate

Automatic Mappings:

Concept Pine Script NinjaScript Tradovate
Close price close Close[0] d.close()
Previous close close[1] Close[1] history.prior().close()
SMA ta.sma(src, len) SMA(src, len)[0] SMA(len)(value)
New session ta.change(time("D")) Bars.IsFirstBarOfSession d.tradeDate() !== lastDate

validate - Syntax Validation

Checks indicator code against official platform documentation.

/trading-indicators:pine:validate LB_MyVWAP.pine

Checks include:

  • Function signature correctness
  • Deprecated function detection
  • Version compatibility
  • Resource limit compliance

test - Structure & Logic Validation

Validates indicator structure and tests calculation correctness.

Structure validation:

/trading-indicators:ninja:test MyVWAPLB.cs --validate

Logic validation:

/trading-indicators:ninja:test MyVWAPLB.cs --logic

Tests include:

  • Required sections present
  • Input/parameter definitions
  • Plot validity
  • Edge case handling (first bar, zero volume, session boundaries)

debug - Error Troubleshooting

Identifies and fixes runtime errors.

/trading-indicators:tradovate:debug MyIndicatorLB.js --error "undefined is not a function"

Common issues handled:

Platform Error Type
Pine Script NA values, array bounds, label limits
NinjaScript NullReferenceException, IndexOutOfRange
Tradovate undefined functions, null history access

explain - Indicator Analysis

Analyzes and explains what an indicator does in plain language.

/trading-indicators:pine:explain LB_MyVWAP.pine

Output includes:

  • Purpose summary
  • Input documentation
  • Calculation steps
  • Trading interpretation
  • Dependencies

refactor - Code Improvement

Reorganizes code for better structure and performance.

Modes:

/trading-indicators:pine:refactor LB_MyVWAP.pine --organize    # Group inputs, organize sections
/trading-indicators:pine:refactor LB_MyVWAP.pine --modernize   # Update to latest syntax
/trading-indicators:pine:refactor LB_MyVWAP.pine --optimize    # Performance improvements
/trading-indicators:pine:refactor LB_MyVWAP.pine --cleanup     # Remove unused code

compare - Indicator Comparison

Compares two indicators or cross-platform versions.

Same platform:

/trading-indicators:pine:compare LB_MyVWAP_v1.pine LB_MyVWAP_v2.pine

Cross-platform:

/trading-indicators:pine:compare LB_MyVWAP.pine MyVWAPLB.cs --cross-platform

cleanup - Remove Dead Code

Removes unused variables, commented code, and fixes formatting.

/trading-indicators:ninja:cleanup MyVWAPLB.cs

document - Generate Documentation

Creates documentation from indicator code.

Markdown README:

/trading-indicators:pine:document LB_MyVWAP.pine --format md

Inline comments:

/trading-indicators:pine:document LB_MyVWAP.pine --format inline

Pattern Libraries

The plugin includes scaffold patterns for each platform. Invoke them to get structure guidance:

/trading-indicators:pine-patterns
/trading-indicators:ninja-patterns
/trading-indicators:tradovate-patterns

Pine Script Patterns

  • Input group structure (Feature Toggles, Settings, Colors)
  • Session detection with timezone handling
  • VWAP calculation with standard deviation bands
  • Persistent state using var keyword
  • Resource limit management

NinjaScript Patterns

  • Namespace and class structure
  • Lifecycle methods (OnStateChange, OnBarUpdate)
  • Property attributes with validation
  • Series object initialization
  • Drawing object patterns

Tradovate Patterns

  • Class structure (init, map, filter)
  • Module exports with params and plots
  • History access patterns
  • Session detection with tradeDate()
  • Helper function initialization

Specialized Agents

The plugin provides 10 specialized AI agents:

Agent Role Use When
pine-expert Pine Script v5/v6 specialist Creating/modifying Pine indicators
ninjascript-expert NinjaTrader 8 C# specialist Creating/modifying NinjaScript
tradovate-expert Tradovate JavaScript specialist Creating/modifying Tradovate
converter Cross-platform translation Converting between platforms
code-reviewer Quality review (read-only) Pre-commit code review
debugger Error troubleshooting Runtime error analysis
testing-agent Structure/logic validation Pre-deployment validation
documentation-generator README generation Creating user docs
performance-analyzer Optimization analysis (read-only) Performance bottlenecks
doc-researcher Official docs lookup Syntax verification

Usage Examples

Example 1: Create a Session VWAP Indicator

User: Create a new Pine Script v6 indicator that calculates session VWAP
      with 1SD and 2SD bands for /ES futures

Claude: [Invokes /trading-indicators:pine:new-indicator SessionVWAP --v6]

        I'll create a new Pine Script v6 indicator with:
        - Session VWAP calculation with reset at RTH open (9:30 AM ET)
        - 1 and 2 standard deviation bands
        - Proper input groups for customization

        [Creates LB_SessionVWAP.pine]

Example 2: Convert Pine Script to NinjaScript

User: Convert my VWAP indicator to NinjaTrader

Claude: [Invokes /trading-indicators:pine:convert LB_SessionVWAP.pine --to ninja]

        Converting with the following mappings:
        - close → Close[0]
        - ta.sma() → SMA()[0]
        - input.int() → [NinjaScriptProperty] int
        - session detection → Bars.IsFirstBarOfSession

        [Creates SessionVWAPLB.cs]

Example 3: Debug a Runtime Error

User: My NinjaScript indicator shows "Index was outside the bounds of the array"

Claude: [Invokes /trading-indicators:ninja:debug MyIndicatorLB.cs --error "Index outside bounds"]

        Root cause: Accessing Close[10] when CurrentBar < 10

        Fix: Add bar history check
        Before: double value = Close[10];
        After:  if (CurrentBar < 10) return;
                double value = Close[10];

Trading Context

All indicators developed with this plugin are optimized for:

Setting Value
Instruments /ES (S&P 500), /NQ (Nasdaq 100) futures
Timeframe 5-minute bars
Session RTH 9:30 AM - 4:00 PM ET
Timezone America/New_York

Key Concepts

  • VWAP - Volume Weighted Average Price with standard deviation bands
  • TWAP - Time Weighted Average Price for confirmation
  • Initial Balance - First 30-60 minutes range
  • Classic Pivots - Daily/weekly pivot levels

Project Structure

trading-indicator-plugins/
├── plugins/
│   └── trading-indicators/
│       ├── .claude-plugin/
│       │   └── plugin.json          # Plugin configuration
│       ├── agents/                  # 10 specialized agents
│       │   ├── pine-expert.md
│       │   ├── ninjascript-expert.md
│       │   ├── tradovate-expert.md
│       │   ├── converter.md
│       │   ├── code-reviewer.md
│       │   ├── debugger.md
│       │   ├── testing-agent.md
│       │   ├── documentation-generator.md
│       │   ├── performance-analyzer.md
│       │   └── doc-researcher.md
│       ├── commands/                # 33 commands (11 per platform)
│       │   ├── pine/
│       │   ├── ninja/
│       │   └── tradovate/
│       └── skills/                  # 3 pattern libraries
│           ├── pine-patterns/
│           ├── ninja-patterns/
│           └── tradovate-patterns/
└── README.md

File Naming Conventions

Platform Pattern Example
Pine Script LB_<Name>.pine LB_SessionVWAP.pine
NinjaScript <Name>LB.cs SessionVWAPLB.cs
Tradovate <Name>LB.js SessionVWAPLB.js

Workflow Philosophy

All commands follow a consistent workflow:

  1. Discussion First - Claude discusses the approach before generating code
  2. Documentation Verification - Syntax verified against official docs
  3. Approval Required - Changes presented for approval before implementation
  4. No Auto-Commit - Users test and commit changes manually

Requirements

  • Claude Code CLI
  • For development:
    • TradingView account (Pine Script)
    • NinjaTrader 8 (NinjaScript)
    • Tradovate account (JavaScript)

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request

License

MIT License - See LICENSE file for details.


Support

For issues or questions:

About

Claude Code plugin marketplace for trading indicator development (Pine Script, NinjaScript, Tradovate)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published