Hi Guys,
I am new to the platform and, after following some tutorials to keep up with pace, I've decided to implement some strategies from the “Algorithmic Trading: Winning Strategies and Their Rationale” book to see if I could confirm (or not) the alleged returns and to gain more knowledge on the platform.
With that in mind, I would like to share you some of my results to hear from more experienced users what do they think about the algo, the pitfalls, how we could improve it together, etc.
The first algo is a simple mean reverting, that uses a fixed hedge ratio between two assets (in this case, two ETFs, EWA and EWC). I think the result is ok, not stellar. I have explained all the steps in the following medium post:
And here is the backtest (an updated version compared to the Medium).
So, if you guys gave any ideas about it ,I would be glad to hear and work together.
Regards,
Maurício
Louis Szeto
Hi Mauricio
Thank you for sharing this with the QC and Medium communities. We also have our version of pair trading using cointegration (similar concept to yours) and copula. Check out our strategy library blog!
Although tested stationary, however, linear regression's coefficient is an ex-post metric on the cointegration relationship of the 2 assets. Consistent re-estimation for the spread's stochastic process will be more desirable. So the 1.312 is better to be set as a variable and revise from time to time. While period recalibration of the cointegrating vector is one way to do so, more scholars suggested that using a Kalman Filter for ex-ante spread path estimation and smoothening is more sensitive and robust. You may check on Dr. Daniel Palomar's video on YouTube to get some insight on that.
Best,
Louis Szeto
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Maurício Cordeiro
Hi Louis Szeto ,
First of all, thank you for the insights. It's nice that you have already a Pair trading algo implemented. I will definitely take a look and try to run some comparisons.
Concerning the dynamic behavior of the hedge ratio, I am aware of it. The Kalman Filter version is almost ready. I have developed Kalman Filter class instead of using the pykalman (there is also a medium story explaining it) and I am writing a QC algo to compare the results. As soon as I have the results I will share them here.
Regards
Mauricio
Maurício Cordeiro
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!