Pine script 松树文字:直方图的颜色可以';不要上色

Pine script 松树文字:直方图的颜色可以';不要上色,pine-script,forex,Pine Script,Forex,我是一个松树脚本初学者程序员 我想做一个平均蜡烛长度的指示器 所有直方图条都将是黑色的,除了它大于蜡烛(高-低)的10% 默认颜色为黑色 绿色的故事是绿色蜡烛的故事 红色的故事是红烛的故事 绿色的故事是绿色蜡烛的故事 红色的故事是红烛的故事 实际上,蜡烛的长度是整个蜡烛的长度 /@version=3 研究(“蜡烛长度”) len=输入(20,minval=1,title=“#计算平均值的条数”) 总和=0.0 条形图颜色=黑色//默认颜色 对于i=0.0到len-1 总和:=总和+(高[i]-低

我是一个松树脚本初学者程序员

我想做一个平均蜡烛长度的指示器 所有直方图条都将是黑色的,除了它大于蜡烛(高-低)的10%

默认颜色为黑色

绿色的故事是绿色蜡烛的故事

红色的故事是红烛的故事

绿色的故事是绿色蜡烛的故事

红色的故事是红烛的故事

实际上,蜡烛的长度是整个蜡烛的长度

/@version=3
研究(“蜡烛长度”)
len=输入(20,minval=1,title=“#计算平均值的条数”)
总和=0.0
条形图颜色=黑色//默认颜色
对于i=0.0到len-1
总和:=总和+(高[i]-低[i])
绿色的故事=0//绿色蜡烛的故事
红色的故事=0//红烛的故事
绿色较低的故事=0//绿色蜡烛的较低故事
红色较低的故事=0//红色蜡烛的较低故事
乘数=1.0
乘数:=iff(闭合=10.0,100.0,乘数)
活动条长度=(闭合-打开)*乘数
实际上_bar_length=(高-低)//蜡烛的总长度
//绿色蜡烛
如果(关闭>打开)
绿色上一个故事=高接近//绿色蜡烛的上一个故事
绿色低电平=低电平打开//绿色蜡烛的低电平
如果(绿色上部故事>(实际长度*0.1))//如果绿色上部故事>(实际长度/10),蜡烛条将为蓝色
条形图颜色:=蓝色
//红烛
如果(关闭<打开)
红色上部故事=高开//红色蜡烛的上部故事
red_lower_tale=关低//红烛的下半部
如果(红色下限值>(实际下限值*0.1))//如果红色下限值>(实际下限值/10),蜡烛条将为黄色
条形图颜色:=黄色
如果(活动条长度>0)
活动条长度:=活动条长度*1
if(活动条长度<0)
活动条长度:=活动条长度*-1
绘图((总和/长度)*乘数)
绘图(活动条形图长度,颜色=条形图颜色,title=“test1”,样式=直方图,线宽=3)
问题是直方图条总是黑色的

您忘了使用绿色和红色蜡烛的操作员检查这里:

// for GREEN candles
if (close > open)
    green_upper_tale = high-close       // the upper tale of the green candle
    green_lower_tale = open-low         // the lower tale of the green candle

// for RED candles
if (close < open)
    red_upper_tale = high-open          // the upper tale of the red candle
    red_lower_tale = close-low          // the lower tale of the red candle

// for GREEN candles
if (close > open)
    green_upper_tale = high-close       // the upper tale of the green candle
    green_lower_tale = open-low         // the lower tale of the green candle

// for RED candles
if (close < open)
    red_upper_tale = high-open          // the upper tale of the red candle
    red_lower_tale = close-low          // the lower tale of the red candle
green_upper_tale = 0.0                    // the upper tale of the green candle
red_upper_tale = 0.0                      // the upper tale of the red candle
green_lower_tale = 0.0                    // the lower tale of the green candle
red_lower_tale = 0.0                      // the lower tale of the red candle