Forum

Determine second highest bar within a set range

I wonder if someone can assist? I'm looking to determine the second highest bar within a set number of bars . This is my code, but it does not produce the correct answer, as can be seen in the attached chart. The highest bar is H 1=16 (correct), reduce search range 1: from 1 to 15 H A=8(correct)