I'm trying to send a variable into the argument "length" to my Aroon indicator.
If I do it using the internal pine function "highestbars", I get this error :
"Cannot call highestbars
with arguments (series[float], series[float]); available overloads: highestbars(series[float], integer) => series[integer]; highestbars(integer) => series[integer];"
My work around so far is to recreate the internal function I need as a normal function into my script.
Ex. If I need to send a variable length to my sma, I add that function to my script and use that function instead.
my_sma(price, length) =>
sum = price
for i = 1 to length-1
sum := sum + price[i]
sum / length
The problem is that I can't find the code for Highestbar and I tried to do it my self but I never get the same result as pine. Thanks you very much for your time.
Coding it my self Looking if someone already done that Went on google Went on PineScript v4 reference
I tried a lot with for but I failed... so the closest result I have so far is with :
plot(highestbars(high,5)) //Expected result
myhigh =0
myhigh := (high <= high[1]) ? myhigh[1]-1 : (high<high[1]) ? 0 : 0
plot(myhigh,color=color.red) //This result != pinescript function :(
I expect that function to output the same result as the Pine Script internal function highestbars