0
votes

Code looks something like this:

vol = stdev(returns, 21)
weight = int(1 / vol)

I then try to call the function highest(source, length) where the length of the series is determined by the weight variable but I get the error message "Cannot call 'highest' with arguments (series[float], series[integer]); available overloads: highest(series[float], integer) => series[float]; highest(integer) => series[float]".

Same issue if I use round(x) rather than int(x) (or int(round(x))) or round(int(x))). However, highest(source, int(21.41)), for example, works.

How can I get Pinescript to run highest(source, weight)?!

1

1 Answers

0
votes

According to TradingView support, the length argument in highest(source, length) cannot vary, i.e. it is not really an int but a const int.