#### hQrGrIg8lY

##### New member

https://tlc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/V-Z/ZigZagHighLow.html

I am looking at the ZigZagHighLow() function in ToS. It seems to detect the high and low at trend reversal in a robust way. But I am not following the algorithm it follows. Can anybody help explain the algorithm in a human-friendly way? Thanks.

My question is how the top and bottom points of ZigZags are determined. I am not concerned whether it is repainting or not.

Could you help describe the algorithm in detail? Specifically, the doc says the following. Suppose A, B, C (from early time to later time) are a local low and two local highs, what if both point B and point C are higher than point A by the "certain calculated value" and C is a little higher than B? How to determine if A and B should be connected or A and C should be connected. The doc is not clear about this, but I don't understand how the code works to figure this out.

I am looking at the ZigZagHighLow() function in ToS. It seems to detect the high and low at trend reversal in a robust way. But I am not following the algorithm it follows. Can anybody help explain the algorithm in a human-friendly way? Thanks.

My question is how the top and bottom points of ZigZags are determined. I am not concerned whether it is repainting or not.

Could you help describe the algorithm in detail? Specifically, the doc says the following. Suppose A, B, C (from early time to later time) are a local low and two local highs, what if both point B and point C are higher than point A by the "certain calculated value" and C is a little higher than B? How to determine if A and B should be connected or A and C should be connected. The doc is not clear about this, but I don't understand how the code works to figure this out.

ZigZagHighLow plot identifies and connects swing points if the difference between their prices exceeds a certain calculated value. This value is equal to the specified percentage of price change plus Average True Range (ATR) multiplied by a factor. This sum can include an additional constant to increase the distance between the swing points.

Last edited by a moderator: