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.
QUANTCONNECT COMMUNITY
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.
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.
Warren Harding
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...
Johnny VanNuland
, 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))
{
Liquidate();
}
}
Warren Harding
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.
Apollos Hill
Hi Warren, interesting strategy. My friend manually trades this way. he looks for stocks that have plummeted below their 52 week low then buys and holds them. Do your half a million dollar in fees on this backtest get subtracted from your earnings to give you a net income of 1.5 million?
SherpaTrader
Hi WarrenÂ
Thanks for sharing. Why did you select those select ETFs, any strategy behind it?
Warren Harding
Hi Appolos, sorry I missed you, it looks like that is what is happening.
Hi SherpaTrader. I can't recall exactly, I probably screened for high dollor volume ETF's on Finviz or something.
Note that this algo buys and sells in an overly simplistic fashion, you shouldn't enter or exit large poistions with a single market order due to slippage if you are going to trade it live. Instead you might want to build up and exit positions with multiple limit orders.
SherpaTrader
When you say multiple limit orders for exit, do you mean one per stock ticker? I was planning on doing stop trailing loss on these at certain %, but 1 per stock
Warren Harding
No I mean multiple orders per ticker.
Warren Harding
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!