Overall Statistics |
Total Trades 3 Average Win 0% Average Loss 0% Compounding Annual Return 7.098% Drawdown 14.600% Expectancy 0 Net Profit 105.544% Sharpe Ratio 1.013 Probabilistic Sharpe Ratio 47.806% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.063 Beta -0.027 Annual Standard Deviation 0.059 Annual Variance 0.003 Information Ratio -0.362 Tracking Error 0.172 Treynor Ratio -2.209 Total Fees $3.68 |
class HorizontalCalibratedThrustAssembly(QCAlgorithm): def Initialize(self): self.SetStartDate(2010, 1, 30) # Set Start Date self.SetCash(100000) # Set Strategy Cash self.AddEquity('SPY', Resolution.Daily) # SP500 ETF self.AddEquity('TLT', Resolution.Daily) # Long-Term Treasuries ETF self.AddEquity('VXX', Resolution.Daily) # VIX ETF self.AddEquity('GLD', Resolution.Daily) # Gold ETF commodities = [ 'USO', # Oil ETF 'DBA', # Agriculture ETF 'LIT' # Lithium ETF ] self.adx = {} for ticker in commodities: self.AddEquity(ticker, Resolution.Daily) self.adx[ticker] = self.ADX(ticker, 50, Resolution.Daily) self.EnableAutomaticIndicatorWarmUp = True def OnData(self, data): if self.IsWarmingUp: return if not self.Portfolio.Invested: self.SetHoldings('SPY', .24) self.SetHoldings('TLT', .18) self.SetHoldings('VXX', .21) self.SetHoldings('GLD', .19) commodities2buy = [] for ticker, adx in self.adx.items(): if adx.PositiveDirectionalIndex.Current.Value > 70: commodities2buy.append(ticker) else: self.Liquidate(ticker) if len(commodities2buy) > 0: alloc = .18 / len(commodities2buy) for ticker in commodities2buy: self.SetHoldings(ticker, alloc)