我如何将没有 运行 的蜡烛绘制到这个特定错误中?

how do i plot the candles without running into this specific error?

我尝试了很多方法来解决这个错误,但我似乎无法解决它。我正在尝试绘制 heiken ashi 图表,但我 运行 遇到此错误“无法使用参数 'title'='CColor' 调用 'plotcandle'。'series color' 的参数使用了类型,但需要 'const string'”,我是初学者,我不明白错误是什么。我该如何解决?

//@version=5
indicator("HA")

// Heiken Ashi

Open = (open[1] + close[1])/2
Close = (open + high + low + close)/4
High = math.max(high, math.max(open, high))
Low = math.min(low, math.max(open, high))

CColor = if Close > Open
    color.lime
else
    color.red

plotcandle(Open, High, Low, Close, CColor)

错误消息表明您正在将 color 传递给 title 参数。

plotcandle() 的第四个参数是 title 而不是 color

plotcandle(open, high, low, close, title, color, wickcolor, editable, show_last, bordercolor) → void

如果你不想给它起标题,也不想给它指定颜色,你可以这样做:

plotcandle(Open, High, Low, Close, color=CColor)

脚本如下

//@version=5
indicator("HA")

// Heiken Ashi

Open = (open[1] + close[1])/2
Close = (open + high + low + close)/4
High = math.max(high, math.max(open, high))
Low = math.min(low, math.max(open, high))

CColor = Close > Open ? color.lime :color.red

plotcandle(Open, High, Low, Close, color = CColor)