# PineForge — offline PineScript v6 backtest MCP

Transpiles PineScript v6 into C++ to execute local strategy backtests against OHLCV market data. Keeps your trading code private and works offline without third-party API tokens.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 7
- Author: pineforge-4pass
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/pineforge-4pass/pineforge-backtest-mcp
- Updated: 2026-10-23
- HTML: https://affpapa.org/en/nevibecode/mcp/pineforge-offline-pinescript-v6-backtest-mcp

## What it does

The server operates over stdio inside a self-contained container. It bundles the `pineforge-codegen` utility to translate PineScript v6 source code into C++ binaries on the fly. Calculations execute locally. Proprietary strategy code and market records never leave your drive.

Tooling covers single runs via `backtest_pine`, multi-parameter sweeps using `backtest_pine_grid`, and Binance market data collection. The `check_tradingview_parity` tool evaluates trade records against TradingView exports to confirm identical execution behavior.

File paths in tool arguments require absolute `/work/...` paths. The container working directory is `/app`, meaning relative paths write to temporary container storage that vanishes upon exit. Always keep the `-i` flag and omit `-t` because allocating a TTY breaks the JSON-RPC stream.

## Requirements
- Needs: Docker

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add pineforge-offline-pinescript-v6-backtest-mcp -- docker run -i --rm ghcr.io/pineforge-4pass/pineforge-backtest-mcp:v0.9.40
```

### Codex

**Platform CLI**
```bash
codex mcp add pineforge-offline-pinescript-v6-backtest-mcp -- docker run -i --rm ghcr.io/pineforge-4pass/pineforge-backtest-mcp:v0.9.40
```

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "pineforge-offline-pinescript-v6-backtest-mcp": {
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "ghcr.io/pineforge-4pass/pineforge-backtest-mcp:v0.9.40"
            ]
        }
    }
}
```

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "pineforge-offline-pinescript-v6-backtest-mcp": {
            "type": "stdio",
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "ghcr.io/pineforge-4pass/pineforge-backtest-mcp:v0.9.40"
            ]
        }
    }
}
```

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add pineforge-offline-pinescript-v6-backtest-mcp docker run -i --rm ghcr.io/pineforge-4pass/pineforge-backtest-mcp:v0.9.40
```

## When to use it
- Run deterministic PineScript v6 backtests locally without TradingView
- Compare local algorithmic trades against TradingView Strategy Tester exports
- Execute Cartesian sweeps across strategy inputs with `backtest_pine_grid`
- Download spot or perpetual OHLCV candlestick data from Binance

## Example prompts
- Backtest the PineScript logic in `strategy.pine` using the bar data in `/work/btc_1h.csv`.
- Fetch 1h klines for BTCUSDT from Binance and save them directly to `/work/binance_btc.csv`.
- Compare our strategy execution against `/work/tv_report.csv` with `check_tradingview_parity`.

## Similar
- [World Monitor](https://affpapa.org/en/nevibecode/mcp/world-monitor.md) — MCP server · ★ 89609
- [CCXT](https://affpapa.org/en/nevibecode/mcp/ccxt.md) — MCP server · ★ 44591
- [Finance Toolkit](https://affpapa.org/en/nevibecode/mcp/finance-toolkit.md) — MCP server · ★ 5469
- [EdgarTools](https://affpapa.org/en/nevibecode/mcp/edgartools.md) — MCP server · ★ 2817
- [LetsFG — Flights & Hotels](https://affpapa.org/en/nevibecode/mcp/letsfg-flights-hotels.md) — MCP server · ★ 2197
- [AutoTS](https://affpapa.org/en/nevibecode/mcp/autots.md) — MCP server · ★ 1434

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
