//version=5
indicator("缠论分析指标", overlay=true)
// === 计算分型 ===
top_fractal = ta.highest(high, 3)[1] == high[1] and high[1] > high[0] and high[1] > high[2]
bottom_fractal = ta.lowest(low, 3)[1] == low[1] and low[1] < low[0] and low[1] < low[2]
// 画出分型信号
plotshape(top_fractal, location=location.abovebar, color=color.red, style=shape.triangleup, title="顶分型")
plotshape(bottom_fractal, location=location.belowbar, color=color.green, style=shape.triangledown, title="底分型")
// === 识别笔 ===
var float lastTop = na
var float lastBottom = na
if top_fractal
lastTop := high[1]
if bottom_fractal
lastBottom := low[1]
// 画出笔(顶底连接)
plot_pen_top = plot(lastTop, title="顶笔", color=color.red, linewidth=2, style=plot.style_stepline)
plot_pen_bottom = plot(lastBottom, title="底笔", color=color.green, linewidth=2, style=plot.style_stepline)
// === 计算中枢(简单版)===
var float zhongshu_top = na
var float zhongshu_bottom = na
if not na(lastTop) and not na(lastBottom)
zhongshu_top := math.min(lastTop, lastTop[1])
zhongshu_bottom := math.max(lastBottom, lastBottom[1])
// 先绘制中枢边界
plot_zhongshu_top = plot(zhongshu_top, title="中枢上沿", color=color.blue, linewidth=2)
plot_zhongshu_bottom = plot(zhongshu_bottom, title="中枢下沿", color=color.blue, linewidth=2)
// 使用 fill() 填充中枢区域
fill(plot1=plot_zhongshu_top, plot2=plot_zhongshu_bottom, color=color.blue, transp=80, title="中枢填充")
indicator("缠论分析指标", overlay=true)
// === 计算分型 ===
top_fractal = ta.highest(high, 3)[1] == high[1] and high[1] > high[0] and high[1] > high[2]
bottom_fractal = ta.lowest(low, 3)[1] == low[1] and low[1] < low[0] and low[1] < low[2]
// 画出分型信号
plotshape(top_fractal, location=location.abovebar, color=color.red, style=shape.triangleup, title="顶分型")
plotshape(bottom_fractal, location=location.belowbar, color=color.green, style=shape.triangledown, title="底分型")
// === 识别笔 ===
var float lastTop = na
var float lastBottom = na
if top_fractal
lastTop := high[1]
if bottom_fractal
lastBottom := low[1]
// 画出笔(顶底连接)
plot_pen_top = plot(lastTop, title="顶笔", color=color.red, linewidth=2, style=plot.style_stepline)
plot_pen_bottom = plot(lastBottom, title="底笔", color=color.green, linewidth=2, style=plot.style_stepline)
// === 计算中枢(简单版)===
var float zhongshu_top = na
var float zhongshu_bottom = na
if not na(lastTop) and not na(lastBottom)
zhongshu_top := math.min(lastTop, lastTop[1])
zhongshu_bottom := math.max(lastBottom, lastBottom[1])
// 先绘制中枢边界
plot_zhongshu_top = plot(zhongshu_top, title="中枢上沿", color=color.blue, linewidth=2)
plot_zhongshu_bottom = plot(zhongshu_bottom, title="中枢下沿", color=color.blue, linewidth=2)
// 使用 fill() 填充中枢区域
fill(plot1=plot_zhongshu_top, plot2=plot_zhongshu_bottom, color=color.blue, transp=80, title="中枢填充")
免責事項
この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。
免責事項
この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。
