Progress Update 9

    This week I got a lot done towards my ultimate goal of creating my SPY trading algorithm. Last week I just started using QuantConnect and made myself try and complete their "Boot Camp" that they had which is used to showcase what Python functions and development tools they offer. Yesterday I completed QuantConnect's Boot Camp which went over a variety of different strategies. Today I started to build the framework of my algorithm in QuantConnect's IDE (Integrated Development Environment) and continued reading Conquering The Seven Faces of Risk by Scott M. Juds which I started reading this week as well.

    Now I'll be real, I most likely won't use most of the strategies that the Boot Camp taught me because they still stem from the "diversify & rebalance" views of Modern Portfolio Theory (MPT) which I basically discussed the flaws of it in the last blog update. Instead, I mainly saw the Boot Camp as a way to familiarize myself with QuantConnect's development tools.

    One really cool feature is the importing of modules/code blocks. This feature allows you to start from a basic framework instead of starting on a blank .py Python file. For me, I didn't use any of the pre-made Alpha code blocks since I am creating my own Alpha model.

    This is the modules/code block features of starting to create an algorithm on QuantConnect that I am talking about. It's hard to describe it over text.






    I did use the trailing stop module to implement into my algorithm. I know I used very tight stops in my SPY algorithm and got stopped out quite a bit. So maybe a looser trailing stop will work better. I can only experiment and see what works.

    Anyways, this week I started reading Conquering The Seven Faces of Risk by Scott M. Juds. Just because I am moving onto a new book doesn't mean I finished the last one: Trend Following by Michael Covel. My Dad told me to start reading Conquering The Seven Faces of Risk because as I started more algorithmic programming work, I started to ask more questions about quantitative analysis rather than asking questions about the philosophies of trend following which is what Trend Following seemed to focus a lot on (of what I read really).

    One general topic that Conquering The Seven Faces of Risk talked about right off the bat was Scott Juds' frustration with trying to invest in the stock market. Whenever he failed and lost money, he was told the same thing over and over again: "diversify and re-balance". This quote is in direct reference to MPT and how diversifying your stock portfolio with less correlated stocks can decrease variance, which in MPT is seen as "risk", in order to avoid said "risk".

    The fatal flaw of MPT that Scott Juds points out is that this "diversify & re-balance" strategy is that not only does avoiding variance avoid sharp downturns, it avoids sharp upswings. Avoiding variance in this way "mutes" the returns of putting your chips all in one basket. Wouldn't you want to be a part of the sharp upswings?

    The key part in MPT is to get as close to the efficient frontier as you can. If you don't know, according to Investopedia, the efficient frontier is "...the set of optimal portfolios that offer the highest expect return for a defined level of risk..."



    Above is a diagram of the efficient frontier that students of MPT fantasizes about getting to. This theory is built on adding assets to a portfolio that are less correlated to each other to move left on the x-axis of standard deviation. Trying to mathematically balance high-risk, high-reward investments with low-risk, low-reward investments in order to get as close to the efficient frontier as possible.

    For most people who are naturally risk-averse, this is the perfect strategy for them that allows them to sleep at night thinking that they are making consistent returns. In reality, it is hard to predict the returns from these strategies mainly because MPT is based on calculating expected returns off of previous data. Nobody can predict the market consistently, so nothing is guaranteed

    Another thing I learned so far from reading this book is what the Sortino ratio. The Sortino ratio is a what is called a risk-adjusted return calculation. Similarly to Sharpe ratio in which the measurement is used to quantify how good a trading strategy is. TradingView and QuantConnect both use Sharpe ratio to quantify how good your trading algorithms are. The Sortino ratio is different from a Sharpe ratio in which you substitute the use of standard deviation in Sharpe ratio's formula with downside deviation. This goes back to what I said above: wouldn't you want to be a part of the sharp upswings? So why treat all levels of standard deviation as "evil" instead of just treating the downsides as such?

    So now that I know the difference between Sortino ratio and Sharpe ratio, which one is better? It really comes down to personal preference I think.

    So, that was all the important stuff I learned this week. For the time being, I am now starting on converting my algorithm I created in TradingView's PineScript into Python on QuantConnect. So I will update this blog when I move along in my coding enough but also when I learn enough interesting things to share through reading my books. Just so this blog isn't boring with just coding computer science stuff.

-Jamie


    

Comments