Skip to content

Repository files navigation

Pine Script Agents for Google Antigravity

License: MIT Maintained by: Codee Studio Hire on Fiverr Telegram Pine Script Google Antigravity

A professional, autonomous Pine Script v6 development suite maintained and ported by Codee Studio for native execution inside Google Antigravity, based on the open-source architecture by TradersPost.


1. What This System Is

Pine Script Agents provides an end-to-end engineering pipeline for developing, auditing, debugging, testing, optimizing, and publishing TradingView indicators and strategies in modern Pine Script v6.

Once installed globally, you can open any Pine Script project or empty directory in Antigravity and immediately access:

  • Autonomous Agent Skills: Specialized capabilities invoked on-demand or by model context.
  • Global Slash Workflows: Interactive guided commands (/pine-start, /pine-architect, /pine-developer, /pine-auditor, /pine-debug, /pine-backtest, /pine-optimize, etc.).
  • Complete Pine Script v6 Offline Reference: 35+ concept, reference, and syntax manuals.
  • Bulkowski Pattern Knowledge Base: 50+ formalized chart pattern specifications from thepatternsite.com.
  • Pre-Built Templates & Examples: Battle-tested indicator, strategy, and utility code.
  • YouTube Video Strategy Extractor: Automatically transcribe and convert trading tutorials into Pine Script code.

2. Architecture & Agent Hierarchy

The system follows a disciplined, multi-layered development hierarchy:

graph TD
    User([User Prompt / Idea]) --> Architect[Pine Architect<br/><i>Scoping & Tech Spec</i>]
    Architect --> Developer[Pine Developer<br/><i>Pine Script v6 Coding</i>]
    Developer --> Auditor[Pine Auditor<br/><i>Repainting & Quality Check</i>]
    Auditor --> Debugger[Pine Debugger<br/><i>Surgical Error Resolution</i>]
    Auditor --> Backtester[Pine Backtester<br/><i>Metrics & Drawdown Analysis</i>]
    Backtester --> Optimizer[Pine Optimizer<br/><i>Robustness & Anti-Overfitting</i>]
    Optimizer --> Publisher[Pine Publisher<br/><i>House Rules & Secret Sanitization</i>]
    
    subgraph Supporting Roles
        Visualizer[Pine Visualizer<br/><i>Mermaid Diagrams & Video Extractor</i>]
        Explorer[Pine Explorer<br/><i>Codebase & Pattern Lookup</i>]
        Helper[Beginner Helper<br/><i>Accessible Concept Explanations</i>]
    end
Loading

3. What Was Ported vs What Changed for Antigravity

Original Claude Code Feature Antigravity Replacement Rationale
.claude/ directory & CLAUDE.md ~/.gemini/config/plugins/pinescript-agents/ & Antigravity rules Conforms to Antigravity's native plugin architecture and hierarchical rule discovery.
Hardcoded Node.js MCP server (/Users/hartman/...) Native pinescript-docs MCP (uvx pinescript-mcp) + offline markdown docs Zero-config cross-platform availability without machine-specific paths or node runtime overhead.
POSIX Bash hooks (after-edit.sh, before-write.sh) Antigravity Plugin Rules (pinescript-v6-rules.md) & pine-auditor Shell scripts assuming Unix bash and hardcoded paths fail on Windows. Replaced with declarative rules and dedicated auditor skills.
Claude slash commands (commands/*.md) Antigravity Global Workflows (~/.gemini/config/global_workflows/pine-*.md) Antigravity natively maps markdown files in global_workflows/ to slash commands accessible across all workspaces.
File locking system (lock / unlock) Native workspace isolation & safe edit boundaries Antigravity guarantees workspace isolation by default; project scripts stay inside the user's workspace.
Video Analyzer tool Cross-platform Python utility with automatic dependency installation Enhanced with graceful fallbacks and UTF-8 console support on Windows.

4. Global Installation & Lifecycle Management

All scripts are located in scripts/ and use Windows PowerShell conventions without hardcoded usernames.

Global Installation

Open PowerShell in the pinescript-agents-antigravity directory and run:

.\scripts\install.ps1

What this does:

  1. Installs the plugin into ~/.gemini/config/plugins/pinescript-agents/.
  2. Registers all /pine-* workflows into ~/.gemini/config/global_workflows/.
  3. Sets up templates, examples, Bulkowski pattern specs, and the Pine Script v6 reference manual.

Check Status

.\scripts\status.ps1

Update

.\scripts\update.ps1

Uninstall

.\scripts\uninstall.ps1

5. Available Roles & Skills

  1. pine-architect: Transforms unstructured trading ideas into structured technical specifications, identifying indicators, session filters, order sizing, and repainting risks before coding.
  2. pine-developer: Implements Pine Script v6 using modern syntax (parentheses line wrapping, for...in collection iterations, active input conditionals, linestyle attributes, UDT-first architecture).
  3. pine-auditor: Dedicated review layer checking for request.security lookahead bias, unconfirmed realtime bar leakage, commission/slippage assumptions, and code defects.
  4. pine-debugger: Surgically diagnoses compiler errors (plot in local scope, line continuation, dynamic loop boundaries) and implements minimal fixes without rewriting scripts.
  5. pine-backtester: Evaluates TradingView Strategy Tester outputs and trade CSVs, computing Sharpe, Sortino, expectancy, and recovery factors, clearly distinguishing [DATA FROM TRADINGVIEW] from [CALCULATED METRICS].
  6. pine-optimizer: Evaluates parameter sensitivity plateaus to prevent curve-fitting and market overfitting.
  7. pine-visualizer: Models state machines and indicator relationships with Mermaid diagrams, and runs video strategy extractions.
  8. pine-publisher: Prepares release documentation conforming to TradingView House Rules while strictly scrubbing webhooks and credentials.
  9. pine-explorer: Searches patterns, templates, examples, and the reference library.
  10. beginner-helper: Provides plain-English explanations and analogies for beginners.

6. Available Global Slash Workflows

Slash Command Purpose
/pine-start Interactive wizard to plan, build, audit, optimize, or analyze
/pine-architect Scope a new trading idea into a complete technical specification
/pine-developer Write Pine Script v6 code for indicators or strategies
/pine-auditor Audit a script for repainting, lookahead, and realism
/pine-debug Surgically diagnose and fix compilation or runtime errors
/pine-backtest Analyze backtest data, calculate risk ratios, and review drawdowns
/pine-optimize Perform parameter sensitivity and robustness analysis
/pine-visualize Render strategy flowcharts and state machines with Mermaid
/pine-publish Format release notes, House Rules checklist, and alert payloads
/pine-templates Browse and load pre-built indicator, strategy, and utility templates
/pine-examples Browse working reference implementations across complexity tiers
/pine-video Extract trading rules from a YouTube video URL

7. 10 Practical Example Prompts

You can use any of these prompts in any workspace once installed:

  1. New Strategy Specification:

    "Act as Pine Architect: Create a technical specification for an intraday Gold (XAUUSD) 15-minute strategy using 200 EMA trend filter, RSI pullback, and ATR trailing stop."

  2. Pine Script v6 Implementation:

    "Implement a Pine Script v6 strategy for a Supertrend + EMA crossover with dynamic position sizing risking 1% equity per trade."

  3. Repainting & Lookahead Audit:

    "Audit this multi-timeframe strategy for repainting, lookahead leakage in request.security(), and unconfirmed bar assumptions."

  4. Surgical Debugging:

    "Debug this Pine Script error: 'Cannot use plot in local scope at line 42'. Provide a minimal fix."

  5. Backtest Metric Analysis:

    "Analyze this TradingView backtest: 152 trades, 54% win rate, Net Profit $12,400, Max Drawdown $1,800. Calculate Expectancy, Profit Factor, and Sharpe Ratio."

  6. Robustness & Anti-Overfitting:

    "Review these optimization results for my RSI strategy. Are these parameters robust or overfitted to historical noise?"

  7. Converting Indicator to Strategy:

    "Convert this Pine Script custom indicator into a complete strategy with 1:2 risk/reward ratio, realistic slippage, and alert messages."

  8. YouTube Video Extraction:

    "Analyze this trading video tutorial: https://www.youtube.com/watch?v=EXAMPLE and convert the strategy into Pine Script v6."

  9. Visual Architecture Diagram:

    "Draw a Mermaid state flowchart showing the trade lifecycle, session filter, and exit conditions for this strategy."

  10. Publication Preparation:

    "Prepare this Pine Script for TradingView community release. Format the description, verify House Rules, and ensure all webhook URLs and credentials are sanitized."


8. Limitations

  • Real-Time Webhook Execution: TradingView alert webhooks require an external listener/connector (such as TradersPost); Pine Script cannot directly send authenticated REST calls to brokers.
  • Tick-Level Order Book Simulation: Historical backtesting on TradingView approximates intrabar fills; tick-level order book depth is unavailable in historical Pine bars.
  • YouTube Caption Fallback: If a video lacks auto-generated or manual captions, Whisper audio transcription requires ffmpeg installed on your system.

9. Custom Pine Script Development & Consulting

Need custom Pine Script indicators, algorithmic trading strategies, multi-timeframe systems, or TradersPost webhook automation?

Codee Studio specializes in professional TradingView development, custom indicator suites, institutional Smart Money Concept (SMC) systems, and strategy optimization:


10. Acknowledgments & Upstream Attribution

  • Ported, enhanced, and maintained for Google Antigravity by Codee Studio.
  • Based on the open-source pine-agents architecture originally created by TradersPost.
  • Chart pattern statistical data sourced from Thomas Bulkowski's ThePatternSite.com.
  • Released under the MIT License.

Contributors

Languages