我正在尝试编写一个代码,为满足以下条件的所有条形图着色:
1. 它们的收盘价高于 20 周期移动平均线
,并且
2. 它们收盘价高于给定周期(比如 20 天)的最高价
这是我当前的代码:
hp1 = highest(high, 20) //HH from given period
myMA = sma(close, 20) //my moving average to plot
plot(myMA)
myCond = close > hp1 and close > myMA
barcolor(myCond? yellow: na) //if condition is met
该代码似乎是合乎逻辑的,但不起作用。有什么建议么?