trophy

Long Only, ETF Alpha Streams Competition with $27,500 Prize Pool

Back

Momentum Strategy with Market Cap and EV/EBITDA

This momentum universe selection strategy is converted from Johnny Wu's EV/EBITDA Value, then momentum. 

In coarse universe selection, the algorithm picked the stocks with fundamental data and excluded the stocks with low price. In fine universe selection, filtered the stocks with the positive EV/EBITDA ratio and high market cap. Here market cap was calculated by using the BasicAverageShares in earnings reports. price per share was extracted from history request. In fine universe selection, self.Porfolio[symbol].Price cannot be used to get the current price as the price data are not subscribed. 

Then the universe was ranked by EV/EBITDA and top 100 stocks were selected. The resulting screen was sorted according to the return of past 200 days. The algorithm picked the top  10 high momentum stocks. The universe is rescreened and rebalanced every month.

The strategy also added a moving average(SPY) market exit towards long-term treasuries TLT to control the downside risk. If the current SPY price is lower than last N-day moving average price, then liquidate all the open positions and buy TLT.

Update Backtest








0

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.


Hi Jing Wu and community,

Thanks for sharing! I noticed that the code, as originally written, seems to produce an oscillation with moving into/out of TLT while SPY is below its moving average. Here is a track record of the trades executed during 2008:

Not sure if this is intended?

Kind Regards.

0

Hi Ivan,

You're correct, this is not how the algorithm should be operating -- that is to say, it is doing what the code is telling it to do, but not what we want it to do. The offending line is the self.Liquidate() line in the snippet below. As it is written, this will liquidate all positions rather than the specific stock with the ticker represented by symbol.Value. The commented out line will ensure that just the proper tickers are liquidated. I've attached a backtest (with a shorter testing window to speed things up) that gives the results of this code change.

if self.Securities[self.spy].Price < spy_hist.mean():
for symbol in self.Portfolio.Keys:
if symbol.Value != "TLT":
self.Liquidate()
# Proper function will happen if replaced with the line below
# self.Liquidate(symbol.Value)
self.AddEquity("TLT")
self.SetHoldings("TLT", 1)
0

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.


Update Backtest





0

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.


Loading...

This discussion is closed