Is this code valid in a system test? (peak)

Hi

I have created a custom indicator called 'myindicator' (doesnt matter what it is, its a squiggly line with peaks and troughs). I want to detect when todays value is greater than the most recent peak and the previous peak of the indicator. I know using peak function can give false results when used in system tests. Is it valid to use the following code in a system test:
myindicator>Peak( myindicator , 1, n = 1)AND myindicator >Peak( myindicator , 1, n = 2)

If it is NOT valid to use in a system test, how else can i do it?

Many thanks!

Hi,

As long as you use n=1 in those functions, it will reference the last leg which can give false results.

Explained here

Hi NSM

Thank you for replying - appreciated. Yes, i already red this. What other way is there to detect 'when todays value is greater than the most recent peak and the previous peak'

cheers