| Overall Statistics |
|
Total Trades 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe Ratio 0 Probabilistic Sharpe Ratio 0% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio -0.662 Tracking Error 0.208 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
class UncoupledVentralPrism(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2020, 1, 1)
#self.SetEndDate(2017, 5, 19)
self.SetCash(100000)
self.tickers = ['ZW',
'ZN',
'CL',
'GC']
self.fast = {}
self.slow = {}
for ticker in self.tickers:
future = self.AddFuture(ticker)
future.SetFilter(lambda x: x.FrontMonth().OnlyApplyFilterAtMarketOpen())
self.symbol = None
self.fast[future] = ExponentialMovingAverage(10)
self.slow[future] = ExponentialMovingAverage(50)
def OnData(self, slice):
holding = None if self.symbol is None else self.Portfolio.get(future)
if holding is not None:
# Buy the futures' front contract when the fast EMA is above the slow one
if self.fast.Current.Value > self.slow.Current.Value:
if not holding.Invested:
self.SetHoldings(future, .1)
elif holding.Invested:
self.Liquidate(future)