PineScript策略管理工具

一个用于创建、优化和管理PineScript交易策略的综合工具,适用于金融交易和策略开发场景。

  • by cklose2000
  • HTML
  • 本地部署
  • 105 星标
  • 更新于
在 GitHub 查看 cklose2000/pinescript-mcp-server

使用说明

PineScript MCP项目

一个用于创建、优化和管理PineScript交易策略的综合工具。

项目结构

├── src/             # Core application code
├── ui/              # Next.js web interface
├── dist/            # Compiled JavaScript
├── docs/            # Documentation
├── scripts/         # Utility scripts
│   ├── server/      # Server management scripts
│   ├── network/     # Network diagnostics scripts
│   └── docs/        # Documentation
├── data/            # Data files
├── tests/           # Application tests
├── examples/        # Example scripts and strategies
└── memory-bank/     # Project context and information

快速开始

  1. 安装依赖项:

    npm install
    
  2. 启动UI(选择一种方法):

    # Standard Next.js development server
    npm run ui
    
    # Clean start with port cleanup
    npm run ui:clean
    
    # Alternative Express server (if Next.js has issues)
    npm run ui:express
    
    # Desktop app (no web server required)
    npm run ui:electron
    
  3. 访问web界面:

    http://localhost:3001
    

    (桌面应用程序选项不需要)

UI选项

该项目包括多种访问UI的方式:

1.Next.js开发服务器

# Standard Next.js dev server
npm run ui

# Clean start (kills any existing processes using the ports)
npm run ui:clean

# Start with administrator privileges (for stubborn processes)
npm run ui:admin

2.替代服务器选项

# Simple Express server (more stable alternative)
npm run ui:express

# Basic HTML test page server
npm run ui:test

3.桌面应用程序

对于web服务器存在连接问题的环境:

# Electron desktop application (no web server required)
npm run ui:electron

UI服务器故障排除

如果您遇到UI服务器的连接问题:

  1. 检查防火墙设置
  2. 运行防火墙例外脚本: npm run firewall:allow
  3. 请参阅 scripts/docs/ui-connect-guide.md 用于详细的连接故障排除
  4. 尝试桌面应用程序选项: npm run ui:electron

实用程序脚本

该存储库包括几个实用程序脚本,以帮助开发和故障排除:

基本服务器脚本(在Scripts/Server/中)

  • run-ui-clean.bat -启动UI服务器的主脚本(清理现有进程)
  • run-ui-admin.bat -以管理员权限启动UI服务器
  • serve-test-page.bat -在端口8000上提供一个简单的HTML测试页面来测试连接
  • run-express-server.bat -启动Express服务器作为Next.js的替代方案
  • run-electron-app.bat -启动Electron桌面应用程序(不需要web服务器)

网络故障排除(在脚本/Network/中)

  • check-connectivity.bat -全面的网络连接诊断
  • check-windows-firewall.bat -检查防火墙状态和规则
  • allow-node-firewall.bat -将Node.js添加到Windows防火墙例外
  • test-network-connection.bat -测试特定网络连接
  • test-port-3000.bat -测试端口3000是否可用
  • kill-port-3000.bat -使用端口3000终止任何进程

文档(在scripts/docs/中)

  • ui-connect-guide.md -UI连接故障排除综合指南
  • README-UI.md -UI特定文档

发展

先决条件

  • Node.js(v18或更高版本)
  • npm(v8或更高版本)

建设项目

npm run build

运行测试

npm test

特性

  • 战略创建和编辑
  • 回测能力
  • 性能分析
  • 策略优化
  • TradingView集成

Claude桌面集成

PineScript MCP服务器可以与Claude Desktop集成,提供人工智能辅助的PineScript开发功能。

快速入门(macOS)

# Install and configure with one command
npx pinescript-mcp-server

# Or add to Claude Desktop
claude mcp add pinescript-server npx --args pinescript-mcp-server

快速入门(Windows)

# Add to Claude Desktop with Windows-specific wrapper
claude mcp add pinescript-server cmd --args /c npx pinescript-mcp-server

文档

有关详细的设置说明、特定于平台的配置和故障排除:

示例配置

Claude Desktop中提供的功能

与Claude Desktop集成后,您可以:

  • 创建和编辑PineScript策略
  • 运行回溯测试并分析性能
  • 优化交易参数
  • 生成与TradingView兼容的代码
  • 访问实时市场数据(使用正确的API配置)

文档

请参阅 docs/ 详细文档目录:

  • api参考
  • 用户指南
  • 开发指南

许可证

该项目是专有和机密的。

版权所有©2025。保留所有权利。