Overall Statistics |
Total Trades 45 Average Win 3.27% Average Loss -2.66% Compounding Annual Return 8.223% Drawdown 5.400% Expectancy 0.147 Net Profit 12.126% Sharpe Ratio 0.889 Probabilistic Sharpe Ratio 42.154% Loss Rate 49% Win Rate 51% Profit-Loss Ratio 1.23 Alpha 0.058 Beta 0.033 Annual Standard Deviation 0.066 Annual Variance 0.004 Information Ratio 0.245 Tracking Error 0.156 Treynor Ratio 1.767 Total Fees $81.31 Estimated Strategy Capacity $1200000.00 Lowest Capacity Asset SNPS R735QTJ8XC9X |
# Pair momentum spread from AlgorithmImports import * SYMBOLS = ["CDNS","SNPS"]; MOM = 2; class WTIBRENTSpread(QCAlgorithm): def Initialize(self): self.SetStartDate(2021, 1, 1) self.SetCash(100000) self.symbols = [self.AddEquity(ticker, Resolution.Minute).Symbol for ticker in SYMBOLS] self.mom = {} for symbol in self.symbols: self.mom[symbol] = self.MOM(symbol, MOM, Resolution.Daily) self.SetWarmUp(MOM + 1, Resolution.Daily) def OnData(self, data): if self.Time.time() != time(10, 31): return if self.IsWarmingUp: return if not (self.mom[self.symbols[0]].IsReady and self.mom[self.symbols[1]].IsReady): return spread = self.mom[self.symbols[0]].Current.Value - self.mom[self.symbols[1]].Current.Value self.Plot("spread", "spread", spread) if spread > 10: self.SetHoldings(self.symbols[0], -0.5) self.SetHoldings(self.symbols[1], 0.5) elif spread < -10: self.SetHoldings(self.symbols[0], 0.5) self.SetHoldings(self.symbols[1], -0.5)