As far as I can see at a glance, it looks mostly correct except for a few things. The "return" statements in the count loop are not in Ehler's code, and should also not be in the C code. And ClosesUp, Denom, MyRSI must be series, not single variables.