Using 'trough' to find shortened downthrust

Hi, I'm trying to identify a shortening of the downthrust using 'trough' function.

The downthrust I define as (the close at the current trough) - (low at previous trough).

I have the following but obviously it's not working. Looking for some help please.

_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() ); 

x = Param("% change",.01,0.001,2,0.001);
Plot( z = Zig(c, x), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();

a = Trough(C,x);
b = Trough(l,x,1);

aa = Trough(C,x,1);
bb = Trough(L,x,2);


d = a<b;
dd = aa<bb; 

e = b-a   < bb-aa;


Buy = dd AND d  AND e;//
Sell = False;

PlotShapes(IIf(Buy,shapesmallUptriangle,shapeNone),colorwhite,0,L,-15);

delete delete delete delete

where's the delete button?

@C_M if you want to cancel your post, there is a way. After hitting the "Reply button" there is a garbage can that you can make appear (expand the three dots ...) that if you hit, will delete your post.

image

1 Like