We started with downloading price data from Yahoo Finance, with the help of the bt.feeds.YahooFinanceData() function. What followed was a series of operations connected to Cerebro, as described here:
- Creating the instance of bt.Cerebro and setting stdstats = False, in order to suppress a lot of default elements of the plot. Doing so avoided cluttering the output, and then we manually picked the interesting elements (observers and indicators).
- Adding data, using the adddata method.
- Setting up the amount of available money, using the broker.setcash method.
- Adding the signal/strategy, using the add_signal/addstrategy methods.
- Adding Observers, using addobserver. We selected two Observers: BuySell, to display the buy/sell decisions ...