Exercise

Perform a strategy benchmarking

You are wondering: instead of spending energy actively trading a stock, what if you just sit back and hold the stock for a period of time. Does your active trading strategy generate better profits than a passive buy-and-hold strategy? To answer this question, you plan to perform a benchmarking test.

The bt package has been imported for you. Also, the historical price data of the Tesla stock has been preloaded in price_data.

In addition, the three strategy backtests sma10, sma30. sma50 from the previous exercise have been pre-loaded, and can be used directly.

Instructions 1/3

undefined XP
    1
    2
    3
  • Define a passive buy and hold strategy, and return a bt backtest.