Overall Statistics |
Total Trades 35 Average Win 0.22% Average Loss -0.42% Compounding Annual Return -67.208% Drawdown 7.100% Expectancy -0.360 Net Profit -7.069% Sharpe Ratio -6.189 Probabilistic Sharpe Ratio 0.485% Loss Rate 58% Win Rate 42% Profit-Loss Ratio 0.52 Alpha -0.877 Beta 0.025 Annual Standard Deviation 0.14 Annual Variance 0.02 Information Ratio -7.64 Tracking Error 0.156 Treynor Ratio -35.158 Total Fees $52.58 |
class ModulatedCalibratedThrustAssembly(QCAlgorithm): def Initialize(self): self.SetStartDate(2019, 12, 1) # Set Start Date self.SetEndDate(2019, 12 , 25) self.SetCash(100000) # Set Strategy Cash self.UniverseSettings.Resolution = Resolution.Daily self.SetExecution(ImmediateExecutionModel()) self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel()) self.SetRiskManagement(TrailingStopRiskManagementModel(0.02)) tickers = ["AAPL", "FB", "GOOG", "AMD"] symbols = [Symbol.Create(ticker, SecurityType.Equity, Market.USA) for ticker in tickers] self.SetUniverseSelection(ManualUniverseSelectionModel(symbols)) self.AddAlpha(MomentumAlpha()) class MomentumAlpha(AlphaModel): def __init__(self): self.indicators = {} def Update(self, algorithm, data): insights = [] for symbol in self.indicators: rsi = self.indicators[symbol].rsi if rsi.Current.Value < 30: insights.append(Insight.Price(symbol, timedelta(days = 2), InsightDirection.Up)) elif rsi.Current.Value > 70: insights.append(Insight.Price(symbol, timedelta(days = 2), InsightDirection.Down)) return insights def OnSecuritiesChanged(self, algorithm, changes): for security in changes.AddedSecurities: symbol = security.Symbol if symbol not in self.indicators: self.indicators[symbol] = SymbolData(algorithm, symbol) class SymbolData: def __init__(self, algorithm, symbol): self.algorithm = algorithm self.symbol = symbol self.rsi = self.algorithm.RSI(symbol, 14, MovingAverageType.Exponential, Resolution.Daily) self.rsi.Updated += self.OnRSIUpdated def OnRSIUpdated(self, sender, updated): self.algorithm.Plot("RSI", self.symbol.Value, updated)