I am basing my algo on the following:

Create a 20 hour TEMA

If the most recent TEMA value is greater than 4 days ago, hold a long position, if 4 days is lower, then go short.

I have graphed the strategy, and it looks like it creates profit. However, I can't seem to get the same performance from my algo.

 

I would love some feedback on my code, hopefully someone knows what I am doing wrong.

Author