hello
the last chapter of the advanced programming course is creating a complete zigzag indicator and I would like to clarify my understanding of how the code (copied below) works.
The parts I would like to unpack are determining the percentage variation which is then compared to the defined % variation (specified or dynamically).
Peakpercent = (higher – close)/higher
troughpercent = (close-lower)/lower
Taking the peakpercent, it seems higher is being compared to the current close rather than the close of the last trough? Any explanation or insight would be greatly appreciated.
thanks
Chris