Pine Script v5/v6 indicator scaffold and patterns. Provides structure guidance and triggers doc-researcher for current syntax verification. Use when developing TradingView indicators.
用于 Pine Script v5/v6 指标开发的轻量级脚手架。
务必使用文档研究员代理或 Ref MCP 工具验证:
标准组(使用 group= 参数):
功能开关 - 主启用/禁用开关
VWAP 设置 - VWAP 配置
VWAP 带 - 标准差带设置
时段设置 - 基于时间的参数
初始平衡 - IB 配置
开盘区间 - OR 设置
枢轴点 - 枢轴配置
显示选项 - 视觉设置
颜色 - 颜色配置
适当设置:
参考:/Users/lgbarn/Personal/Indicators/Tradingview/LBRHMAs.pine
pinescript
//@version=6
// 此 Pine Script® 代码受 Mozilla Public License 2.0 条款约束,详见 https://mozilla.org/MPL/2.0/
// © lgbarn
indicator(LB 简单均线交叉, shorttitle=LB_MACross, overlay=true)
// === 输入 ===
fastLength = input.int(9, 快线均线长度, minval=1, group=均线设置)
slowLength = input.int(21, 慢线均线长度, minval=1, group=均线设置)
useLightTheme = input.bool(false, 浅色主题, group=显示)
// === 计算 ===
fastMA = ta.ema(close, fastLength)
slowMA = ta.sma(close, slowLength)
// === 颜色 ===
fastColor = useLightTheme ? color.new(#0000FF, 0) : color.new(#00FFFF, 0)
slowColor = useLightTheme ? color.new(#FF0000, 0) : color.new(#FF6600, 0)
// === 绘图 ===
plot(fastMA, title=快线均线, color=fastColor, linewidth=2)
plot(slowMA, title=慢线均线, color=slowColor, linewidth=2)
if ta.change(time(D)) != 0
cumulativeValue := 0.0
sessionHigh := high
sessionLow := low
// 检测新时段开始
isNewSession = ta.change(time(D)) != 0
// 带时区的时段
isRTH = not na(time(timeframe.period, 0930-1600, America/New_York))
if isNewSession
cumVolume := 0.0
cumVwap := 0.0
cumVwap2 := 0.0
cumVolume += volume
cumVwap += volume * hlc3
cumVwap2 += volume hlc3 hlc3
vwapValue = cumVolume > 0 ? cumVwap / cumVolume : na
variance = cumVolume > 0 ? cumVwap2 / cumVolume - vwapValue * vwapValue : na
stdev = variance > 0 ? math.sqrt(variance) : na
upperBand = vwapValue + stdev
lowerBand = vwapValue - stdev
// 指数移动平均线
emaValue = ta.ema(close, length)
// 加权移动平均线
wmaValue = ta.wma(close, length)
// 赫尔移动平均线
hmaValue = ta.hma(close, length)
// 使用前检查值是否有效
if not na(vwapValue)
plot(vwapValue, color=color.blue)
可用导入:
使用 Ref MCP 搜索:
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 pine-patterns-1776201133 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 pine-patterns-1776201133 技能
skillhub install pine-patterns-1776201133
文件大小: 3.08 KB | 发布时间: 2026-4-15 10:34