Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
EMA spread thingy

Dear Community,

I have been trying to code an algo that would be calculating the spread between 21 and 11 day EMAs and compare the today's spread value to yesterday 's spread value. The idea is if the change is positive and within a certain range the algo buys an index but if the change is negative and within a certain range the algo shorts the index. Hopefully it is going to be roughly "tracing" the index, benefiting from both increases and decreases in price (like swing trading, maybe) at least this is the idea.

(The idea looks somewhat pretty in excel, yet has problems when the volatility is low, but overall it's doing ok)

The "thing" that I coded doesn't generate any logs and I'm kindly asking if anyone could point out what is wrong with this "script".

I am totally new to coding, I have only been learning it for a couple of months, so please excuse me if it's total crap.