I just found an error that wasn't detected by the compiler. I mixed some R syntax in. It's

Code:
var ftATR(int ATRPeriod)



not

Code:
function ftATR(ATRPeriod)