Hello Fawce,
Sorry...a bit fast and loose. The algorithm should be all-in (approximately zero cash balance) and long only. However, it was neither. I replaced the canned moving average transform, mavg, with one based on the batch transform, get_avg. I also added these lines to the start of handle_data:
if get_avg(data,context.stocks[0]) == None:
return
This way, the algorithm doesn't do anything until sufficient time has elapsed to compute the average.
I think everything is fixed now--I welcome testing and comments!
I've gone over to the batch transform for a variety of reasons. I'll post them here (perhaps along with some questions), as time allows.
By the way, it'd be really nice to have something like github's version control and change highlighting. Could I use github as an individual for free? Maybe I could put more mature algorithms there to keep track of what I'm doing (and share the changes with others). At this point, I'm not concerned with keeping my algorithms confidential.
Thanks,
Grant