Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Benjamin Graham fundamentals + TA

LOOKING FOR ADVICES

Hi everyone, first of all, introduction:
Here is my very first algo. Please do not be mistaken, in spite of this beautiful return rate, this is a really bad algo: it is totally static, and any change in the parameters will make the returns fall dramatically.
So why am I posting it ? Because I am looking to learn from the advices of more experienced trader ;) (learning alone and so on)

About the algo:
I implemented 7 filters inspired by Benjamin Graham's criterias on value investing, to select some specific stocks. On this, very basic TA is added (it was just to add a touch of it). Here are the properties:
- Portfolio rebalanced every 6 months, fixed to January and June ;
- Equal weights for all the stocks of the portfolio ;
- Top 1500 market cap companies ;
- Close price must be under the 6 months EWMA and above the 12 months EWMA (I think I implemented it well ?) ;
- Only three of BG criterias:
- An earnings yield (1/PE ratio) at least twice the AAA bond rate, which was 3.5% last time I checked ;
- Total debt < Book value (that i coded as follow: Book value = Total assests - [Total liabilities + goodwill and other intangible assets]) ;
- Current ratio (current assets / current liabilities) > 2 ;
- Go long on the stocks that pass the filters.

My issues:
- The TA I am using is really weak, but in the meantime, if I add any RSI or Bollinger filter, I feel like my algo wouldn't be investing anymore, as it only selects 0 to 10 stocks every 6 months (usually 0, 2 or 4) ;
- The weights are all equal ;
- I only go long ;
- The algo only invests in January and in June ;
- If I apply all BG criterias, no stock is selected for the portfolio.

I have found this article, telling that nowadays, 5% of the stocks of the Asian market meet BG's criterias, for only 1 to 2% to the European market, and that no stocks in the US market meet these requirements (which seems to be what my algo found too...). So for now, I am just applying the three fundamental filters mentionned above, and let the other 4 for later.
(According to Benjamin Graham, would the US market be overvalued ?)

My goals:
- Set a better TA ;
- Set optimized weights ;
- Look for stocks to short ;
- Invest dynamically depending on the month you are starting your backtest (not only in January and July) ;
- Find out what fundamental criterias could fit more the current market.

I will post further versions (it is just a (bad, isn't it ?) beginning).

Another important part now:
If there is anything you want to recommend, are recognizing a path you walked through a long time ago, and are willing to share some advices and experienced feedback, please feel free to do so. I have been studying and reading for a while, and I start feeling really lonely I my quest for knowledge.
I really wish to learn as much as I can (this is a really addicting subject, isn't it ?).

Thanks for your help.
(It starts being late here, i'm not going to check for misspelling, please be kind, I am not a native English speaker, and do not even live in my country of birth :) ) Have a good night !

2 responses

Hi everyone,

Here is another (better) version of my algo.
Why better ? Because it is "more" stable and easier to read, IMO (but still not stable).
Also now, the weight depends on the stock, and the rebalance is not static anymore (you choose the period, and it starts a counter from day 1).

About the algo:
I still use only 3 of the 7 filters I implemented, inspired by Benjamin Graham's criterias on value investing
Here are the properties:
- Rebalance frequence (in trading days) set at the beginning of the algo (for this example, I set 126 days = 6 months). The algo automatically reset and rebalance the portfolio at this frequence ;
- Top 1500 market cap companies ;
- Close price must be under the 6 months EWMA, which must be under the 12 months EWMA ;
- An earnings yield (1/PE ratio) at least twice the AAA bond rate, which was 3.5% last time I checked ;
- Total debt < Book value (that i coded as follow: Book value = Total assests - [Total liabilities + goodwill and other intangible assets]) ;
- Current ratio (current assets / current liabilities) > 2 ;
- Weights are calculated as follow: weights = [1 + growth_score (transformed into a [0:1] range) + (1 - value_score (transformed into a [0:1] range))] (normalized between ]0:1] with a total sum = 1 ;

My issues:
- The TA I am using is still really weak ;
- I only go long ;
- The returns depend a lot on the period ;
- There are some strong drawdowns.

My goals:
- Find a way to reduce the big drawdown trends, or transform them into flat lines, or into an opposite uptrend ;
- Find a way to reduce the impact of the period on the returns ;
- Find out how I can short (based on which criteria and in which proportion) ;
- Set a better TA ;
- Look for other value criterias.

Any recommendation or feedback, I'll take time to dig into it :)

Ps: Thanks for William Liu, who recommended me to use the growth and value score for weighting :)

Would you like to collaborate on this together?