15 min read

PyBroker Tutorial: Backtesting a QQQ Opening Range Breakout Strategy

PyBroker is an open source Python framework for backtesting trading strategies. Recently version 2 was released. The library now has support for portfolios with multiple symbols, margin and leverage, rotational trading strategies, and faster backtests. In this tutorial we'll learn PyBroker by building the intraday strategy in the paper "Can Day Trading Really Be Profitable?" that we discussed in a previous video. This strategy trades a breakout strategy on the symbols QQQ and TQQQ.

We'll compare the PyBroker version of the backtest to the one we previously wrote using backtesting.py and discuss the similarities and differences. Then in the next tutorial, we'll build upon this by backtesting the "Stocks in Play" strategy described in the paper "A Profitable Day Trading Strategy For the US Equity Market". This strategy selects different stocks every morning and will showcase some of PyBroker's strengths, since it's not possible to implement this strategy using backtesting.py.

This post is for subscribers only