The code would be very similar for Zorro. Only make sure that Count is an int, not a float, and find out what sc.GetBarHasClosedStatus(sc.Index) is doing.

On Financial Hacker, Petra has written a few articles about indicator coding.