Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Newbie: Learning Timing with Limits

Hello All,

I am new to quantitative investing. One of the books I recently read use Portfolio123 for its examples. I have never used Portfolio123. I know Python so I figured I can get the same tests here.

In following algorithm, I have tried to do following, however I think I am failing.

Assets: DIA, SPY, QQQ, MDY, IWM
Rebalance: Weekly
Positions: 0 or 5
Maximum Size: 20%
Rules: In Position when 50-day SMA > 200-day SMA, Out of Position when 200-day SMA > 50-day SMA
No Leverage
Transaction Costs 0.1%
Benchmark: S&P 500 Index

My questions:
Does my algorithm performs above?
How do I do weekly re-balance?
How do I add transaction costs?

Thank you all for your help.