An inverted momentum rotation algorithm.

This is a momentum rotation algorithm that I've inverted. Instead of buying the ETF with the most momentum, it buys the ETF that is crashing the hardest. Drawdown is a bit high, use at your own risk.

Update Backtest

These two lines,

Symbol symbol = QuantConnect.Symbol.Create(ticker, SecurityType.Equity, Market.USA);
AddEquity(symbol, resolution);

were causing problems when adding some tickers. Replacing them with this,

AddSecurity(SecurityType.Equity, ticker, resolution);

provides a workaround. Here's the fixed algo...


, Very interesting strategy thanks for sharing Warren Harding 

I read through the code and im not savy at C# so i was wondering if you would mind explaining just a bit. Whichever stock has the largest drop in its 2 day moving average you buy? Is that correct? and how long do you hold that stock for? It looks like you handle the liquidating in this chunck of code i copy and pasted below but i don't understand it. What does this section look for exactly????

   else if (stockDatas.Any(x=>Portfolio[x.Ticker].Quantity>0))


The stockData.MovingAverage indicator is fed with the percent changes in price. It's an exponential indicator so positive recent changes in price will have a significant positive effect on the stockData.MovingAverage value. And vice versa for negative values. Older changes in price will have a less significant effect. So a positive value of stockData.MovingAverage indicates upwards trend, a larger value indicates a stronger upwards trend. A negative value of stockData.MovingAverage indicates downward trend, a larger value indicates a stronger downwards trend.   It's my own invention as far as I know, though I haven't researched it thoroughly and someone else may have conceived of it earlier than myself.

The code you pasted only fires if you uncomment the '//where x.Fitness > 0 line. Ignoring that, the Liquidate call above it is what is being called. It just liquidates before buying the next stock, so the algo is always holding the stock that is the most oversold, and changes positions when a new stock comes along that is more oversold than the last.


Update Backtest


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.


This discussion is closed