How to reference any proceeding zig-zag trough

You need to use CODE TAGS when posting code. See How to use this site

Properly formatted code should look like this:

_SECTION_BEGIN("Price");

SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );

_SECTION_END();

_SECTION_BEGIN("ZZ");

P1 = ParamField( "ZIG Price field" );
change = Param("% change",5,3,15,0.5); // Param( ''name'', defaultval, min, max, step, sincr = 0 );
Color =(ParamColor("ZZ Wave",coloryellow));
Plot( zz=TEMA(Zig(P1, change),1), _DEFAULT_NAME(), Color, styleLine) ;

_SECTION_END();