0
votes

I am currently building my first pine scripts and want to have the following check

check5 = (macd(close,12,26,9) > highest (macd(close,12,26,9), 40)) --> i.e. I want to check if the macd of today is larger than the highest macd over the last 40 days ...

Unfortunately I get this error: Cannot call 'highest' with arguments ([series[float], series[float], series[float]], literal integer); available overloads: highest(series[float], integer) => series[float]; highest(series[float], series[integer]) => series[float]; highest(integer) => series[float]; highest(series[integer]) => series[float];

I have googled for a couple of hours but cannot find a solution to my problem... would strongly appreciate if someone could help?

1

1 Answers

0
votes

Built-in macd function return 3 variables as a result, you have to chose which one of them you wish to evaluate with > operator, in the example below the script check the macdLine values:

[macdLine, signalLine, histLine] = macd(close, 12, 26, 9)
check5 = macdLine > highest(macdLine, 40)