我正在尝试打印mondayAll的值,因为它是作为一系列整数出现的,所以我使用的是最近的值(MondayAll)。然而,这个错误还是会发生的:Cannot call 'string' with 'x'=series[integer]. The argument should be of type: const string;
var int mondayLong = 0
var int mondayAll = 0
// ---------------------------
if(dayofweek == dayofweek.monday)
mondayAll := mondayAll + 1
if(close > open)
mondayLong := mondayLong + 1
val = mondayAll[0]
text1 = "Monday All: " + string(val)
l1 = label.new(bar_index,high[0],text=text1)
label.delete(l1[1])知道怎么解决这个问题吗?
发布于 2021-12-05 18:33:11
使用str.tostring()函数代替。
//@version=5
indicator("My Script")
var int mondayLong = 0
var int mondayAll = 0
// ---------------------------
if(dayofweek == dayofweek.monday)
mondayAll := mondayAll + 1
if(close > open)
mondayLong := mondayLong + 1
val = mondayAll[0]
text1 = "Monday All: " + str.tostring(val)
l1 = label.new(bar_index,high[0],text=text1)
label.delete(l1[1])
plot(close)https://stackoverflow.com/questions/70233690
复制相似问题