0%

【Cont.】 MACD strategy follow up report

The above line chart shows how we have been doing on the enhanced MACD strategy as of today (2020/12/11 EST).

It’s been 19 trading days since we’ve launched our automatic trading script to trade on TD Ameritrade on 2020/11/17. So far, we have accumulated ~6% of the total investment even with a huge dip on Dec 9th.

MACD strategy performance report as of today

- Number
Current position 10
Positive opening position 7 (out of 10)
Negative opening position 3 (out of 10)
Closed trade 1
Current portfolio total return 6.13%

From the line chart below, you can tell the portfolio trend that we constructed is quite correlated with the trend of the Nasdaq index (.IXIC). Meaning, we have a quite correlation with the Nasdaq index.

In the meantime, if you look at the Dow Jones Index and S&P 500 Index, you’ll see we’re actually doubled in return as of today.

Hence, I think we’re doing pretty good so far. Even though the market is still tumbling and the US government hesitated to pull up the economy stimulation for COVID-19, our MACD strategy is still doing ok. Stay tuned for the follow-up report on more detailed analysis until we get enough data to analyze.

What I did

As we all know in my previous article, that Quantopian has disabled their entire service and switched their business to serve enterprise customers (as in here), I’ve been struggling to find a good substitution in my backtesting process.

QuantConnect seems pretty solid and reliable, and its API documentation is very clear. Even though the way to use their APIs is very different from Quantopian and not intuitive to my sense, but it’s still ok to cope with. However, I’ve been spent days trying to run backtesting on QuantConnect, the speed is insanely slow even with VPN. In the end, I have to give up on it.

Then I see people also talking about QuantRocket. It’s essentially a python library run inside docker. To run backtesting, you need to spin up this docker image on your local PC or laptop and connect to the docker container. I simply don’t like how it works and complicated. Plus I didn’t find useful API documentation on their website. So again, I gave it up.

Python backtrader package
This looks to me is the most promising solution that I can find so far. It is very flexible and easy to use. If you know python and happen to be a former Quantopian user, you’ll find a sense of familiarity with this python package. The broker, strategy, data, analyzer, indicators modules are very well written and easy to inherit then build upon it. Nevertheless, one single and the most crucial issue that I can’t resolve by myself, where it’s also not one of the issues that backtrader tries to solve: data source.

Several issues spotted during the exploration backtrader module and I still yet to be able to address regarding ingesting data feed in backtrader:

  1. How to handle stocks that are delisted for good?
  2. How to handle stocks that are delisted temporarily due to SEC’s command?
  3. How to merge multiple stock pricing data that are different in the start and end date?

I’ve been spending ~2 weeks but the progress is limited. Therefore, I turned to the local quantitative platform again since they’ve been existed for years: JoinQuant. This also means, now I’m switching back to China stock market and need to find another broker that has API supports. Maybe Futuniuniu in the near future.

What I’m doing

Right now I’m working on one of the conventional trading strategies from history on JoinQuant: Turtle strategy.

Here are a few articles about Turtle strategy itself and the history of it:

It’s an interesting story and fun to read. Also, I believe there’s a lot of things that I can learn from rebuilding this strategy and put them into practice. Hopefully, I can present you with a turtle strategy that looks like:

and not like:

Cheers.

Disclaimer: Nothing herein is financial advice or even a recommendation to trade real money. Many platforms exist for simulated trading (paper trading) which can be used for building and developing the strategies discussed. Please use common sense and consult a professional before trading or investing your hard-earned money.

Enjoy reading? Some donations would motivate me to produce more quality content