The most interesting i think that happened here is that my algo managed to avoid the crash without liquidating my entire portfolio.
The most interesting i think that happened here is that my algo managed to avoid the crash without liquidating my entire portfolio.
Daniel,
Looks interesting. Would you mind providing an outline of how the algorithm works? I'd like to read through the code, but it'll be easier to understand if I have a sense of the logic first.
Also, how did you arrive at the particular collection of securities to trade?
Thanks,
Grant
Sure thing. Basically I am taking the difference between a short moving average and a long one and I trade based on the changes of it.
If the difference is bigger than 0 its a buy signal since the shorter one is going up faster and same for the downside. Since
there is a lot of noise i put the level of significance of the difference at .25 of the maximum of the past differences meaning
it wont trade based on small fluctuations. I simply chose random stocks that i thought would be very liquid thats all.
Daniel,
Some feedback:
Grant
Hi Grant,
Thank you for your input. The reason I started backtesting it so early is that I wanted to avoid the bias of a bull market.
Any advice on how to make my algo better? I noticed that just defining notional and context.max/min_notional doesnt
really limit order limit. Iv had many cases where i had notional limit and yet the algo was going haywire.
Daniel,
Here is a discussion regarding staying within margin limits:
https://www.quantopian.com/posts/spy-and-sh-z-score-indicator
I haven't sorted through all of the details provided by Dennis C yet, but perhaps you'll find it useful.
Grant