6 Comments
User's avatar
Isak's avatar

Hello,

What backtesting platform are you using to run your backtest on? Is it something custom built or are you using any framework?

Thank you

Isak

Quantitativo's avatar

Hi! Many, many, many years ago, I implemented a backtest engine in Python for my master’s degree… it’s an event-driven engine (they are slower than the vector-based engines but imho they are easier to write strategies for, understand and debug) with all blows and whistles, similar to the late Zipline. In fact, I tried most of the Python backtest engines that exist, and that’s why I prefer to use what I built over the years: I have 100% understanding of what’s happening and 100% control.

Quantish's avatar

Thanks for sharing. Loved the simplicity so much I had to recreate it, and had fun whipping it up.

Here's my implementation for QQQ from Jan'99 - Jul'24, written using QuantConnect.

Some discrepancies, likely due to differences in data and entry timing. I was surprised to see such a difference in the sharpe calculation though... not sure what to make about that one.

1. Interactive Results (with code and performance statistics):

https://www.quantconnect.com/terminal/processCache/?request=embedded_backtest_ad0d3d439e42ea6dee2edde358c38ace.html

2. Report with additional stats against QQQ hold benchmark comparison:

https://www.quantconnect.com/reports/ad0d3d439e42ea6dee2edde358c38ace

3. Report with additional stats against SPY hold benchmark comparison:

https://www.quantconnect.com/reports/bda3d6baab0de972f303f9339e8fb18b

Matthias Blankenberg-Teich's avatar

Super nice work! Thx for sharing

Howard's avatar

A second question just occurred to me (with my apologies for not including it with the one above), namely did you notice any difference in risk/return and absolute performance metrics for this strategy above the QQQ 200 DMA (SDMA and/or EDMA) as opposed to below it? Naïvely I'd initially thought initially that this strategy might work even better above the 200 DMA (especially in terms of win rate) given both that markets are more likely to be in a bull phase and volatility is lower above the 200 DMA. However, OTOH, the actual best returns for this strategy are somewhat anti correlated with the QQQ, i.e. they've been strongest (on the extended back to 1999 back test) when the QQQ has been in a bear phase, with poor annual index returns, which is more associated with being below the 200 DMA. Interested to hear your thoughts.

Howard's avatar

An excellent and very thoughtful piece. Thank you. For the TQQQ variant implementation, may I ask please what slippage rate for combined fees and bid/ask spreads was used per round trip?