"Cannot call 'ta.rsi' with argument 'length'='lowers'. An argument of 'series float' type was used but a 'simple int' is expected"

Viewed 248

I'm getting this error in pine script could someone help me to solve this code please Here is my code

Cannot call 'ta.rsi' with argument 'length'='lowers'. An argument of 'series float' type was used but a 'simple int' is expected

source =(high + low + close)/3
length = input.int(14, minval=1) 
Highlight=input.bool(true, title="Highlight Oversold and Overbought")
uppers = math.sum(volume * (ta.change(source) <= 0 ? 0 : source), length)
lowers = math.sum(volume * (ta.change(source) >= 0 ? 0 : source), length)
mfi = ta.rsi(uppers, lowers)
mfp = plot(mfi, color=color.gray, linewidth=1)
1 Answers

Replace mfi = ta.rsi(uppers, lowers) with mfi = 100.0 - (100.0 / (1.0 + uppers / lowers)) to get the calculation that you intend to; ta.rsi() can no longer be used to calculate mfi like that. You can read more about this behavior in the migration guide.

Related