This thread is meant to continue the development of the In & Out strategy started on Quantopian. The first challenge for us will probalbly be to translate our ideas to QC code.
I'll start by attaching the version Bob Bob kindly translated on Vladimir's request.

About your key error, did you also initialize UUP like this?

self.UUP = self.AddEquity('UUP', res).Symbol