Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Only minor difference in total return between SMA and EMA crossover algorithm

I was back testing my SMA and EMA algorithms and I am only able to find minor difference in their total returns. An appl stock with $1500 initial investment was used to test my algorithms. SMA algo has a total return of 892% whereas EMA algo returned 852% for a period between 2002 and 2015. I am not satisfied with my EMA algos total return. Am i making any mistakes in my EMA algo?. Current EMA algo takes historical datas of 1000 days

PS. I used Dan's SMA Algorithm . only changed the symbol to aapl

EMA,SMA short=10 days
EMA,SMA long=50 days

10 responses

Use order_target_percent instead of a fixed number of stocks. As you get more money, you can reinvest it that way.

stian i have followed your advice and got a wooping total return of about 5000%. I have no clear idea why it worked?

I believe you would massivly overleverage in this case, as you might buy 200 stock, and sell only a hundred. Here is a better exampel:

EMA massivly outperform SMA here,

Stian Yes . I compared EMA and SMA andtEMA clearly outperforms SMA.. any way thanks for taking your time to help me

Why do you take 1000 days data when the EMA is just for 10 and 50 days ?

Don't benchmark it against SPY, benchmark it against the stock you picked. Its a bit misleading to see huge returns when the primary reason is AAPL being up over 7000% in those 13 years

Daniel, thanks for pointing out the mistake. I am new to quantopian and trading; so i am just playing around with tools. I really don’t knew that AAPL has grown over 7000% for past 13 years. Any way its clearly shows EMA crossover algorithm is not best when compared to buy and hold philosophy

@Stian Andreassen how much is your leverage how does it work?

def initialize(context):
context.my_sid = sid(5967) <---- making a hard time changing it to quandul data using fetcher... it doesnt seem.. to work.
context.invested = False

Help Newbie.