Page 1 of 1

Consecutive Closes Up or down

Posted: Sat Nov 05, 2016 6:05 pm
by henry1224
here is the code to count consecutive closes up or down



CU:= C>Ref(C,1);
CD:= C<Ref(C,1);
CCU:BARSSINCEWITHRESET(CU,CD),ColorGreen;
CCD:BARSSINCEWITHRESET(CD,CU),ColorRed;
FillRgn(CCU>0,0,CCU),Brush#50008000;
FillRgn(CCD>0,0,CCD),Brush#50800000;

Re: Consecutive Closes Up or down

Posted: Sat Nov 05, 2016 6:24 pm
by henry1224
here is another way to write the code


dn:= C - REF(C, 1) < 0;
up:= C - REF(C, 1) > 0;
totalcountdn:= SUM(dn);
totalcountup:= SUM(up);
countdn: totalcountdn - VALUEWHEN(totalcountdn, up),ColorRed;
countup: totalcountup - VALUEWHEN(totalcountup, dn),ColorGreen;

Re: Consecutive Closes Up or down

Posted: Tue Sep 19, 2017 6:57 am
by nibor200
Henry1224,

Chris uses the phrase "BARSSINCEWITHRESET" in his latest template script but I can't find a reference for it in the Edgerater online documentation nor the Metastock documentation.

I notice that you used it back in Nov.

Do you have an alternate source of script language documentation that explains this command?

Thanks,
Ed S.