I am using pinescript, and I have been trying to figure out why the following code does not work. The console keeps showing that series[integer] cannot output integer. I understand that series is not compatible with non-series values. If this is the case, is there a way to change series[integer] to integer?
The following code does not work:
x = barssince(crossover(cci,100))
y = barssince(crossover(100,cci))
xy = x-y //in this case the xy value is 9
z = highest(cci, abs(xy))
plot(z)
The following code works:
z = highest(cci, 9) //assuming xy is 9
plot(z)
Any help would be greatly appreciated. Thank you
Thomas