I am currently trying to implement several Future Trend Following strategies based on Andreas Clenows book "Following The Trend", using Quantconnects new Algorithm Framework.
The strategies use simple rules to detect trends in a large, cross-sector universe of Future and a position sizing based on a risk factor and volatiliy.
The very first strategy just uses Moving Average Crosses to trigger rebalancing signals.
The algorithm is initialized by:
class MovingAverageCrossTrendFollowing(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2019, 8, 3) # Set Start Date
self.SetCash(100000) # Set Strategy Cash
# self.AddEquity("SPY", Resolution.Minute)
self.AddAlpha(EmaCrossAlphaModel(50, 200, Resolution.Minute))
self.SetExecution(ImmediateExecutionModel())
self.SetPortfolioConstruction(ATRBasedPositionSizing(riskFactor = 0.2))
self.SetRiskManagement(MaximumDrawdownPercentPerSecurity(0.01))
self.SetUniverseSelection(FuturesUniverseSelectionModel(self.SelectFuturesSymbols))
Where the FuturesUniverseSelectionModel just selects all Futures currently available through Quantconnect:
def SelectFuturesSymbols(self, utcTime):
ticker = [Futures.Indices.SP500EMini,
Futures.Grains.BlackSeaCornFinanciallySettledPlatts,
Futures.Grains.Wheat,
...
Futures.Dairy.ClassIVMilk,
Futures.Dairy.NonfatDryMilk]
return [ Symbol.Create(ticker, SecurityType.Future, Market.USA) for ticker in tickers]
Currently I get a
Runtime Error: SystemError : <bound method 'OnWarmupFinished'> returned a result with an error set SystemError : <bound method 'OnWarmupFinished'> returned a result with an error set (Open Stacktrace)
What could be the problem, here?
Alexandre Catarino
Hi Filib Uster ,
There are some typos in the list of Futures that raised the exception.
Filib Uster
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!