Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Basic Algorithm design by SMA Crossover strategy

Hey, guys. My seminar work will be recored in this theard. i hope i could manage to design a algorithm that actually gain profit after this seminar.

According to the assignment, algorithm should match following requirements:
1. Simple Moving Average.
2. Minutely periodicity.
3. Backtest period (~6-12 months), any ticker.
4. Default slippages and commissions.
5. Initial Quantopian community post.

  1. SMA can be calculated by adding the closing price of the security for a number of time periods and then dividing this total by the number of time periods. In application, short term averages above long term average can be seen as a signal to buy.
    Further, i choose the one of popular patterns-death cross(when the 50-day simple moving average crosses below the 200-day moving average) to design the algorithm (with help of previous work of Pedro Garcia).

  2. As backsets runs every minute, daterules can be neglected.

  3. About tickers, i firtly try to run backtest in trading Apple stock, however the returns are all the time 0. So, i give up and trade SPY instead.

  4. i just read a article about the relation about price of share and commissions. do not understand what is requirement for.

  5. what i am doing now.

2 responses

This week, i started to run couple of backtest with same algorithm but different strategies.
1. Extending the backtest period : the total return become much lower.
2. Changing the SMA basis : results vary little if backtest period is less than one year.

i am wondering if someone can tell me the code of leverage change. I am totally new to the coding, my first algo run so slow and i am planing to tackle the coding part in following weak.

Homework 2 make pipeline to my last strategy.