Overall Statistics |
Total Trades 41 Average Win 0.17% Average Loss -0.46% Compounding Annual Return -69.398% Drawdown 8.200% Expectancy -0.584 Net Profit -7.790% Sharpe Ratio -9.786 Probabilistic Sharpe Ratio 0.000% Loss Rate 70% Win Rate 30% Profit-Loss Ratio 0.37 Alpha -0.894 Beta -1.188 Annual Standard Deviation 0.129 Annual Variance 0.017 Information Ratio -8.56 Tracking Error 0.185 Treynor Ratio 1.066 Total Fees $53.20 |
class ModulatedCalibratedThrustAssembly(QCAlgorithm): def Initialize(self): self.SetStartDate(2019, 12, 20) # Set Start Date 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)