Setting 'Change' in Trough and Zig

Hi, I am trying to understand how to use functions such as Trough, TroughBars and Zig. They all use a parameter called CHANGE however I have not as yet found any documentation that describes what the CHANGE parameter represents. I have of course searched online and within the community forum but have not as yet found an explanation. Below is an example from the LineArray online reference. It sets CHANGE to 5, what does the 5 represent? Thanks in advance...

x0=BarCount - 1 - LastValue(TroughBars(L,5,2)); 
x1=BarCount - 1 - LastValue(TroughBars(L,5,1)); 
Line = LineArray( x0, y0, x1, y1, 1 ); 
Plot(C, "C", colorWhite, styleCandle); 
Plot( Line, "Trend line", colorBlue ); 

@timhopson since these function use the uses the Zig Zag function, "change" is a % change (minimum percent change from peak to trough / trough to peak).

As stated in the Zig() documentation:

Calculates the minimum % change ...

In your code 5 means that you are implicitly using a zig/zag function that requires a minimum of 5% change from the previous occurrence to create a new peak or trough and change the direction.

1 Like

Thanks Beppe, that's helpful. I did see the Zig page you referenced but I needed your fuller explanation to understand. Thanks.

1 Like