You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

启用Line Fill后K线被压缩的Pine Script问题排查

问题:Pine Script v6填充垂直线间区域导致K线压缩变形

在使用Pine Script v6时,填充两条垂直线之间的颜色区域后,蜡烛图(K线)出现了压缩变形的异常。以下是复现该问题的演示脚本:

//@version=6
indicator("Line Fill Bug", overlay = true)

do_line_fill = input.bool(false, "Enable line fill")

var int start_time = na
var int end_time = na

int modulo = bar_index % 20
// log.info("bar_index: {0}, modulo: {1}", bar_index, modulo)

if 0 == modulo
    if na(start_time)
        start_time := time
    else if na(end_time)
        end_time := time

if not na(start_time) and not na(end_time)
    line1 = line.new(start_time, close, start_time, close - 1e-10, extend = extend.both, width = 1, xloc = xloc.bar_time, color = color.blue)
    line2 = line.new(end_time, close, end_time, close - 1e-10, extend = extend.both, width = 1, xloc = xloc.bar_time, color = color.blue)
    if do_line_fill
        linefill.new(line1, line2, color.new(color.blue, 80))
    start_time := na
    end_time := na

问题现象

  • 未启用填充时图表显示正常:
    未启用填充的图表
  • 启用填充后K线出现压缩变形:
    启用填充的图表

请问这是代码编写错误,还是Pine Script的真实bug?

内容的提问来源于stack exchange,提问作者Rostfrei

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.11 22:45:57