mcpField
P
pine-publisher

pine-publisher

github.com/traderspost开发223263 次安装14 周前更新
代码仓库

关于 pine-publisher

pine-publisher 是用于准备 TradingView 社区库 Pine Script 脚本的技能,指导作者检查规则、完善文档与元数据,并整理发布内容。

主要功能

  1. 01检查 TradingView House Rules
  2. 02编写脚本说明与使用文档
  3. 03记录输入项和参数
  4. 04整理标题、标签与分类元数据
  5. 05代码格式与发布检查清单

适用场景

  1. 01准备指标并发布到社区库
  2. 02记录策略逻辑与输入项
  3. 03检查脚本是否符合 House Rules
  4. 04整理标签和版本信息

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/traderspost/pinescript-agents --skill pine-publisher

安装后在 Claude Code 中输入/pine-publisher确认已加载。

详细介绍

Pine Script 发布助手

专注于为 TradingView 社区库发布准备脚本。

核心职责

符合发布规范
  • 确保符合 House Rules
  • 添加所需文档
  • 注明正确的出处
  • 移除任何禁止内容
创建文档
  • 撰写全面的描述
  • 编写使用说明
  • 记录所有参数
  • 添加示例配置
优化元数据
  • 创建适合 SEO 的标题
  • 添加相关标签/类别
  • 撰写吸引人的描述
  • 包含版本信息
专业呈现
  • 规范代码格式
  • 统一命名规范
  • 编写专业注释
  • 准备好示例截图

Pine Script v6 2025 年发布要求

重要:使用最新语法

已发布的脚本应使用 2025 年的新特性,以提供最佳用户体验:

1. 输入项 active 参数(2025 年 7 月)

// ✅ Professional: Conditional input visibility
showAdvanced = input.bool(false, "Advanced Mode", group="Settings")
advSetting = input.int(10, "Advanced Setting",
    group="Settings",
    active=showAdvanced,  // Grayed out when disabled
    tooltip="Only available in Advanced Mode")

2. 绘图线条样式(2025 年 9 月)

// ✅ Professional: Visual hierarchy with line styles
plot(mainMA, "Main MA", color.blue, linestyle=plot.linestyle_solid)
plot(signalLine, "Signal", color.yellow, linestyle=plot.linestyle_dashed)
plot(target, "Target", color.green, linestyle=plot.linestyle_dotted)

3. 对集合使用 for...in(2025 年 3 月)

// ✅ BEST: Use for...in (safe, clean, prevents freezing)
for element in myArray
    // Process element directly

// ✅ With index when needed
for [index, element] in myArray
    // Have both index and value

// ⚠️ FALLBACK: If traditional for needed, cache boundary
arrSize = array.size(myArray)
for i = 0 to arrSize - 1
    // Process...
2025 年发布功能检查清单
  • 条件输入项使用 active 参数
  • 使用 linestyle 区分视觉效果
  • 循环使用 for...in(首选)或缓存边界
  • 三元运算符写在单行上(避免语法错误)
  • 字符串长度不超过 40,960 个字符的限制

遵守 TradingView House Rules

必需元素

对于指标:

// built with PineScript Agents by TradersPost
//@version=6
//@description Comprehensive description of what the indicator does

indicator(title="Professional Indicator Name - Clear Description v1.0",
         shorttitle="PRO IND",
         overlay=true)

对于策略(重要:包含警报注解):

// built with PineScript Agents by TradersPost
//@version=6
//@description Comprehensive description of what the strategy does

strategy(title="Professional Strategy Name - Clear Description v1.0",
         shorttitle="PRO STRAT",
         overlay=true)
//@strategy_alert_message {{strategy.order.alert_message}}

// ============================================================================
// METADATA
// ============================================================================
// Author: Your Name / Username
// Version: 1.0
// Date: 2024-01-15
// Category: Trend Following / Momentum / Volatility / Volume
//
// Description:
// This indicator/strategy provides [clear explanation of functionality].
// It uses [main components/calculations] to generate [type of signals].
//
// Features:
// • Feature 1 description
// • Feature 2 description
// • Feature 3 description
//
// How to Use:
// 1. Add to your chart
// 2. Configure settings as needed
// 3. Look for [signal types]
// 4. Use in conjunction with [complementary analysis]
//
// ============================================================================
禁止内容
  • 不得提供财务建议
  • 不得承诺盈利
  • 不得添加外部链接(文档除外)
  • 不得在代码中添加联系信息
  • 不得使用混淆或压缩代码
  • 不得请求捐赠或打赏
  • 不得包含恶意代码

文档模板

重要:脚本描述的位置

Pine Script 描述应以注释形式写在 .pine 文件顶部,紧接版本声明之后、指标/策略声明之前。

1. 指标文档(放在 .pine 文件顶部)
//@version=6

// ============================================================================
// DOCUMENTATION - THIS GOES AT THE TOP OF YOUR PINE SCRIPT FILE
// ============================================================================
//
// INDICATOR OVERVIEW
// ==================
// This indicator identifies [specific market conditions] by analyzing
// [data sources used]. It is designed for [target audience/use case].
//
// CALCULATION METHOD
// ==================
// The indicator calculates:
// 1. [First calculation] using [formula/method]
// 2. [Second calculation] based on [inputs]
// 3. [Final signal] when [conditions are met]
//
// SIGNALS INTERPRETATION
// ======================
// • Green Triangle: [What it means]
// • Red Triangle: [What it means]
// • Blue Line: [What it represents]
// • Shaded Area: [What it indicates]
//
// SETTINGS GUIDE
// ==============
// Length: Controls the lookback period. Lower = more responsive, Higher = smoother
// Threshold: Sets sensitivity. Range 0-100, default 50
// Mode: Choose between Conservative/Normal/Aggressive
//
// BEST PRACTICES
// ==============
// • Works best on [timeframes]
// • Most effective in [market conditions]
// • Combine with [other indicators] for confirmation
// • Avoid using during [specific conditions]
//
// LIMITATIONS
// ===========
// • May repaint in [specific scenarios]
// • Less effective in [market conditions]
// • Requires at least [X] bars of data
//
// VERSION HISTORY
// ===============
// v1.0 (2024-01-15): Initial release
// v1.1 (2024-02-01): Added multi-timeframe support
// v1.2 (2024-03-01): Performance optimizations
//
// ============================================================================

indicator("Your Indicator Name", shorttitle="Short Name", overlay=true)
2. 策略文档
// ============================================================================
// STRATEGY DOCUMENTATION
// ============================================================================
//
// STRATEGY LOGIC
// ==============
// Entry Conditions:
// • Long: [Specific conditions for long entry]
// • Short: [Specific conditions for short entry]
//
// Exit Conditions:
// • Take Profit: [TP logic]
// • Stop Loss: [SL logic]
// • Trailing Stop: [If applicable]
//
// RISK MANAGEMENT
// ===============
// • Position Size: [How it's calculated]
// • Maximum Risk: [Risk per trade]
// • Maximum Drawdown: [Expected DD]
//
// BACKTESTING NOTES
// =================
// • Tested Period: [Date range]
// • Best Performance: [Market/Timeframe]
// • Win Rate: [Approximate %]
// • Profit Factor: [Approximate value]
//
// ⚠️ DISCLAIMER
// =============
// Past performance does not guarantee future results. This strategy is
// for educational purposes only. Always conduct your own analysis and
// risk management before trading.
//
// ============================================================================
3. 输入项文档
// ============================================================================
// INPUTS WITH DETAILED DESCRIPTIONS
// ============================================================================

// Calculation Settings
length = input.int(
    defval=20,
    title="Calculation Length",
    minval=1,
    maxval=200,
    group="Main Settings",
    tooltip="The number of bars used in the calculation. Lower values (5-20) " +
            "provide faster signals but more noise. Higher values (50-200) " +
            "provide smoother, more reliable signals but with greater lag."
)

sensitivity = input.float(
    defval=1.5,
    title="Sensitivity",
    minval=0.1,
    maxval=5.0,
    step=0.1,
    group="Main Settings",
    tooltip="Controls signal sensitivity. Lower values (0.5-1.0) generate " +
            "fewer, more conservative signals. Higher values (2.0-5.0) generate " +
            "more frequent signals. Default 1.5 is balanced."
)

// Display Settings
showSignals = input.bool(
    defval=true,
    title="Show Buy/Sell Signals",
    group="Display Options",
    tooltip="Toggle the display of entry/exit signals on the chart"
)

showInfoPanel = input.bool(
    defval=true,
    title="Show Information Panel",
    group="Display Options",
    tooltip="Display a panel with current indicator values and market statistics"
)

colorScheme = input.string(
    defval="Professional",
    title="Color Scheme",
    options=["Professional", "Classic", "Dark", "Colorful"],
    group="Display Options",
    tooltip="Choose color scheme:\n" +
            "• Professional: Blue/Red with transparency\n" +
            "• Classic: Green/Red traditional\n" +
            "• Dark: Optimized for dark mode\n" +
            "• Colorful: High contrast colors"
)

SEO 优化

1. 标题优化
// Good titles for discoverability:
"RSI Divergence Scanner with Alerts - Multi Timeframe"
"Bollinger Bands Squeeze Detector Pro v2.0"
"Volume Profile with Support/Resistance Levels"
"Smart Money Concepts - Order Blocks & Fair Value Gaps"

// Include relevant keywords:
// - Indicator type (RSI, MACD, Moving Average)
// - Strategy type (Breakout, Trend Following, Mean Reversion)
// - Special features (Multi-TF, Alerts, Scanner)
// - Version number
2. 类别标签
// Relevant categories to include in description:
// Categories: Trend Analysis, Momentum, Volatility, Volume, Support/Resistance
// Tags: #RSI #Divergence #Alerts #MultiTimeframe #Scanner
// Markets: Forex, Crypto, Stocks, Futures, Indices
// Timeframes: Scalping (1m-5m), Intraday (15m-1h), Swing (4h-D), Position (W-M)

发布检查清单

发布前审核
  • 代码符合 Pine Script v6 标准
  • 策略包含 //@strategy_alert_message {{strategy.order.alert_message}}(位于 strategy() 调用之后)
  • 没有语法错误或警告
  • 所有函数均按预期工作
  • 没有重绘问题(或已明确说明)
  • 性能已优化(加载迅速)
文档完整
  • 描述全面
  • 所有输入项均使用工具提示进行说明
  • 使用说明清晰
  • 已提供示例配置
  • 已披露限制
  • 已包含版本信息
视觉呈现
  • 配色方案专业
  • 图表外观整洁
  • 文字大小清晰易读
  • 适合移动设备显示
  • 已准备好示例截图
合规检查
  • 不提供财务建议
  • 不保证性能
  • 不做外部推广
  • 不包含联系信息
  • 已包含免责声明
  • 对任何借用代码注明出处
元数据优化
  • 标题适合 SEO
  • 描述吸引人
  • 已选择相关类别
  • 已添加恰当的标签
  • 已包含版本号

可直接发布的脚本头部示例

//@version=6
//@description Advanced RSI divergence detector with multi-timeframe analysis and customizable alerts

indicator(title="RSI Divergence Pro - MTF Scanner with Alerts v2.0",
         shorttitle="RSI Div Pro",
         overlay=true,
         max_labels_count=500)

// ╔═══════════════════════════════════════════════════════════════════════╗
// ║                        RSI DIVERGENCE PRO v2.0                         ║
// ║                    Multi-Timeframe Scanner with Alerts                 ║
// ╠═══════════════════════════════════════════════════════════════════════╣
// ║ Author: TradingView_Username                                           ║
// ║ Version: 2.0                                                           ║
// ║ Release Date: January 15, 2024                                         ║
// ║ Category: Momentum Indicators                                          ║
// ║ License: Mozilla Public License 2.0                                    ║
// ╠═══════════════════════════════════════════════════════════════════════╣
// ║                            DESCRIPTION                                 ║
// ╠═══════════════════════════════════════════════════════════════════════╣
// ║ This indicator identifies bullish and bearish RSI divergences across   ║
// ║ multiple timeframes. It features:                                      ║
// ║                                                                         ║
// ║ • Regular and hidden divergence detection                              ║
// ║ • Multi-timeframe confluence analysis                                  ║
// ║ • Customizable alert system                                            ║
// ║ • Visual divergence lines and labels                                   ║
// ║ • Performance statistics table                                         ║
// ║                                                                         ║
// ║ Perfect for: Swing traders, reversal traders, multi-TF analysts        ║
// ╠═══════════════════════════════════════════════════════════════════════╣
// ║                          HOW TO USE                                    ║
// ╠═══════════════════════════════════════════════════════════════════════╣
// ║ 1. Add indicator to chart                                              ║
// ║ 2. Configure RSI settings (default: 14)                                ║
// ║ 3. Set divergence sensitivity (1-5)                                    ║
// ║ 4. Enable desired timeframes for scanning                              ║
// ║ 5. Look for divergence signals:                                        ║
// ║    - Green lines/labels: Bullish divergence                            ║
// ║    - Red lines/labels: Bearish divergence                              ║
// ║ 6. Use confluence table for multi-TF confirmation                      ║
// ╠═══════════════════════════════════════════════════════════════════════╣
// ║                          DISCLAIMER                                    ║
// ╠═══════════════════════════════════════════════════════════════════════╣
// ║ This indicator is for educational purposes only. Past performance     ║
// ║ does not guarantee future results. Always do your own analysis.       ║
// ╚═══════════════════════════════════════════════════════════════════════╝

完善文档并规范发布的脚本,能在 TradingView 社区获得更多浏览、点赞和使用。

评论

支持 Markdown