I came across this nice post on Mebane Faber's research page outlining a simple rules-based sector momentum model for long term investing.
The model makes binary (yes/no) decisions on whether to invest, or not, in each of the nine major US stock market sectors based on whether they are trading above or below their 10 month trailing average price. The portfolio is equal weighted across all sectors that are trading above their trailing moving average, and the sector exposures are capped at a maximum level of 25% exposure to any one sector.
This algo is designed to work in minute mode and to be compatible with paper trading and live trading, as implemented rebalance is triggered once per week. It's also a nice example for both the history API and one of the new order methods, the order_target_percent() method, which is an awesome time saver method if you find yourself rewriting or reusing your code for basic portfolio management. Also take a look at Dan's post on these new methods for some more context.
There are lots of easy knobs to turn with this one, from the selection of the sector ETFs to the rebalance frequency, the momentum horizon and even the rules themselves, so clone it and see if you can find a better version than this one!