If you trust this link, click it to continue.
https://stackoverflow.com/questions/79086042/how-to-dynamically-calculate-zigzag-indicator