pine-developer by traderspost/pinescript-agents
npx skills add https://github.com/traderspost/pinescript-agents --skill pine-developer专注于为 TradingView 编写生产级质量的 Pine Script v6 代码。
在编写任何多行 Pine Script 代码之前,请记住:
? :) - 必须保持在一行内,或者使用中间变量// ❌ 永远不要这样做:
text = condition ? "value1" :
"value2"
// ✅ 总是这样做:
text = condition ? "value1" : "value2"
完整的规则请参见下面的"行换行规则"部分。
主要文档参考:
/docs/pinescript-v6/quick-reference/syntax-basics.md - 核心语法和结构/docs/pinescript-v6/reference-tables/function-index.md - 完整的函数参考广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
/docs/pinescript-v6/core-concepts/execution-model.md - 理解 Pine Script 执行模型/docs/pinescript-v6/core-concepts/repainting.md - 避免重绘问题/docs/pinescript-v6/quick-reference/limitations.md - 平台限制和解决方法根据当前任务需要加载这些文档。
/projects/[项目名称].pinePine Script 有严格的行续行规则,必须遵守:
indicator() 或 strategy() 声明plot(), plotshape(), plotchar() 函数if 语句strategy.entry(), strategy.exit() 调用alertcondition() 调用table.cell() 调用label.new() 和 box.new() 调用// 错误 - 将导致"end of line without line continuation"错误
text = condition ?
"true value" :
"false value"
// 正确 - 整个三元运算符在一行内
text = condition ? "true value" : "false value"
// 正确 - 对于长的三元运算符,分配中间变量
trueText = str.format("Long true value with {0}", param)
falseText = str.format("Long false value with {0}", other)
text = condition ? trueText : falseText
// 正确 - 缩进的续行
longCondition = ta.crossover(ema50, ema200) and
rsi < 30 and
volume > ta.sma(volume, 20)
// 正确 - 函数参数
plot(series,
title="My Plot",
color=color.blue,
linewidth=2)
// 正确 - 长计算
result = (high - low) / 2 +
(close - open) * 1.5 +
volume / 1000000
// 错误 - 相同缩进
longCondition = ta.crossover(ema50, ema200) and
rsi < 30 and
volume > ta.sma(volume, 20)
// 错误 - 缩进不足
plot(series,
title="My Plot",
color=color.blue)
//@version=6
indicator(title="", shorttitle="", overlay=true)
// ============================================================================
// 输入
// ============================================================================
[逻辑分组输入]
// ============================================================================
// 计算
// ============================================================================
[核心计算]
// ============================================================================
// 条件
// ============================================================================
[逻辑条件]
// ============================================================================
// 绘图
// ============================================================================
[视觉输出]
// ============================================================================
// 警报
// ============================================================================
[警报条件]
永远不要在局部作用域内使用 plot() - 这会导致"Cannot use 'plot' in local scope"错误
// ❌ 错误 - 这些都会失败:
if condition
plot(value) // 错误!
for i = 0 to 10
plot(close[i]) // 错误!
myFunc() =>
plot(close) // 错误!
// ✅ 正确 - 使用这些模式代替:
plot(condition ? value : na) // 条件绘图
plot(value, color=condition ? color.blue : color.new(color.blue, 100)) // 条件样式
// 对于局部作用域内的动态绘图,使用:
if condition
line.new(...) // 正确
label.new(...) // 正确
box.new(...) // 正确
//@version=6
strategy("MA Cross Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// 输入
fastLength = input.int(50, "Fast MA Length", minval=1, group="Moving Averages")
slowLength = input.int(200, "Slow MA Length", minval=1, group="Moving Averages")
maType = input.string("EMA", "MA Type", options=["SMA", "EMA", "WMA"], group="Moving Averages")
// 计算
ma(source, length, type) =>
switch type
"SMA" => ta.sma(source, length)
"EMA" => ta.ema(source, length)
"WMA" => ta.wma(source, length)
fastMA = ma(close, fastLength, maType)
slowMA = ma(close, slowLength, maType)
// 条件
longCondition = ta.crossover(fastMA, slowMA)
shortCondition = ta.crossunder(fastMA, slowMA)
// 策略
if longCondition
strategy.entry("Long", strategy.long)
if shortCondition
strategy.close("Long")
// 绘图
plot(fastMA, "Fast MA", color.blue, 2)
plot(slowMA, "Slow MA", color.red, 2)
编写生产就绪、高效且遵循所有 Pine Script v6 最佳实践的代码。
每周安装次数
193
代码仓库
GitHub 星标数
66
首次出现
2026年1月23日
安全审计
安装于
opencode168
gemini-cli165
codex162
github-copilot157
amp145
kimi-cli145
Specialized in writing production-quality Pine Script v6 code for TradingView.
BEFORE writing ANY multi-line Pine Script code, remember:
? :) - MUST stay on ONE line or use intermediate variables// ❌ NEVER DO THIS:
text = condition ? "value1" :
"value2"
// ✅ ALWAYS DO THIS:
text = condition ? "value1" : "value2"
See the "Line Wrapping Rules" section below for complete rules.
Primary documentation references:
/docs/pinescript-v6/quick-reference/syntax-basics.md - Core syntax and structure/docs/pinescript-v6/reference-tables/function-index.md - Complete function reference/docs/pinescript-v6/core-concepts/execution-model.md - Understanding Pine Script execution/docs/pinescript-v6/core-concepts/repainting.md - Avoiding repainting issues/docs/pinescript-v6/quick-reference/limitations.md - Platform limits and workaroundsLoad these docs as needed based on the task at hand.
/projects/[project-name].pinePine Script has STRICT line continuation rules that MUST be followed:
indicator() or strategy() declarations at the topplot(), plotshape(), plotchar() functionsif statements with multiple conditionsstrategy.entry(), strategy.exit() callsalertcondition() callstable.cell() calls// WRONG - Will cause "end of line without line continuation" error
text = condition ?
"true value" :
"false value"
// CORRECT - Entire ternary on one line
text = condition ? "true value" : "false value"
// CORRECT - For long ternaries, assign intermediate variables
trueText = str.format("Long true value with {0}", param)
falseText = str.format("Long false value with {0}", other)
text = condition ? trueText : falseText
// CORRECT - indented continuation
longCondition = ta.crossover(ema50, ema200) and
rsi < 30 and
volume > ta.sma(volume, 20)
// CORRECT - function arguments
plot(series,
title="My Plot",
color=color.blue,
linewidth=2)
// CORRECT - long calculations
result = (high - low) / 2 +
(close - open) * 1.5 +
volume / 1000000
// WRONG - same indentation
longCondition = ta.crossover(ema50, ema200) and
rsi < 30 and
volume > ta.sma(volume, 20)
// WRONG - not indented enough
plot(series,
title="My Plot",
color=color.blue)
//@version=6
indicator(title="", shorttitle="", overlay=true)
// ============================================================================
// INPUTS
// ============================================================================
[Group inputs logically]
// ============================================================================
// CALCULATIONS
// ============================================================================
[Core calculations]
// ============================================================================
// CONDITIONS
// ============================================================================
[Logic conditions]
// ============================================================================
// PLOTS
// ============================================================================
[Visual outputs]
// ============================================================================
// ALERTS
// ============================================================================
[Alert conditions]
NEVER use plot() inside local scopes - This causes "Cannot use 'plot' in local scope" error
// ❌ WRONG - These will ALL fail:
if condition
plot(value) // ERROR!
for i = 0 to 10
plot(close[i]) // ERROR!
myFunc() =>
plot(close) // ERROR!
// ✅ CORRECT - Use these patterns instead:
plot(condition ? value : na) // Conditional plotting
plot(value, color=condition ? color.blue : color.new(color.blue, 100)) // Conditional styling
// For dynamic drawing in local scopes, use:
if condition
line.new(...) // OK
label.new(...) // OK
box.new(...) // OK
//@version=6
strategy("MA Cross Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// Inputs
fastLength = input.int(50, "Fast MA Length", minval=1, group="Moving Averages")
slowLength = input.int(200, "Slow MA Length", minval=1, group="Moving Averages")
maType = input.string("EMA", "MA Type", options=["SMA", "EMA", "WMA"], group="Moving Averages")
// Calculations
ma(source, length, type) =>
switch type
"SMA" => ta.sma(source, length)
"EMA" => ta.ema(source, length)
"WMA" => ta.wma(source, length)
fastMA = ma(close, fastLength, maType)
slowMA = ma(close, slowLength, maType)
// Conditions
longCondition = ta.crossover(fastMA, slowMA)
shortCondition = ta.crossunder(fastMA, slowMA)
// Strategy
if longCondition
strategy.entry("Long", strategy.long)
if shortCondition
strategy.close("Long")
// Plots
plot(fastMA, "Fast MA", color.blue, 2)
plot(slowMA, "Slow MA", color.red, 2)
Write code that is production-ready, efficient, and follows all Pine Script v6 best practices.
Weekly Installs
193
Repository
GitHub Stars
66
First Seen
Jan 23, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
opencode168
gemini-cli165
codex162
github-copilot157
amp145
kimi-cli145
通过 LiteLLM 代理让 Claude Code 对接 GitHub Copilot 运行 | 高级变通方案指南
31,600 周安装
Notion知识捕获工具:将对话笔记自动转为结构化Notion页面,提升团队知识管理效率
2 周安装
SEO标题结构优化指南:H1-H6最佳实践提升网站排名与内容可读性
186 周安装
视觉审计工具:自动检查Quarto、Beamer、Typst文档布局问题,优化排版与间距
2 周安装
文档校对工具proofread - 自动检查语法拼写、格式一致性,生成详细质量报告
2 周安装
Google Tasks 命令行工具 - 高效管理任务的 CLI 工具,支持列表查看、添加、更新和删除
2 周安装
新闻通讯订阅表单生成器 - 提升邮件列表转化率的设计指南与实现方案
186 周安装
label.new() and box.new() calls