Overall Statistics |
Total Trades 32 Average Win 32.91% Average Loss -3.20% Compounding Annual Return 143.411% Drawdown 21.400% Expectancy 3.238 Net Profit 228.330% Sharpe Ratio 2.959 Probabilistic Sharpe Ratio 95.687% Loss Rate 62% Win Rate 38% Profit-Loss Ratio 10.30 Alpha 0.833 Beta 0.043 Annual Standard Deviation 0.318 Annual Variance 0.101 Information Ratio -2.332 Tracking Error 0.661 Treynor Ratio 21.872 Total Fees $11125.05 Estimated Strategy Capacity $9400000.00 |
class CreativeBlueRat(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 1, 1) self.SetEndDate(2021, 5, 1) self.SetCash(100000) self.SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Cash) self.AddCrypto("BTCUSD", Resolution.Daily) self.symbol = self.Securities["BTCUSD"].Symbol #Indicators self.twenty = self.EMA(self.symbol, 20, Resolution.Daily) self.fifty = self.EMA(self.symbol, 50, Resolution.Daily) self.hundred = self.EMA(self.symbol, 100, Resolution.Daily) #self.rsi = self.RSI(self.symbol, 14, Resolution.Daily) self.SetWarmUp(timedelta(100)) self.SetBenchmark(self.symbol) self.entryTicket = None self.exitTicket = None self.entryRisk = 0 self.entryShort = None self.shortRisk = 0 self.highestPrice = 0 def OnData(self, data): if self.IsWarmingUp == True: return #and self.rsi.IsReady if not self.twenty.IsReady and self.fifty.IsReady and self.hundred.IsReady : return self.PlotChart() price = self.Securities[self.symbol].Price quantity = self.CalculateOrderQuantity(self.symbol, 0.9) #Downtrend = Go Short not spported with this account type if self.twenty.Current.Value < self.fifty.Current.Value < self.hundred.Current.Value: return #Uptred = Go Long if not self.Portfolio.Invested and self.twenty.Current.Value > price > self.fifty.Current.Value > self.hundred.Current.Value: self.entryTicket = self.MarketOrder(self.symbol, quantity) self.entryRisk = self.fifty.Current.Value self.highestPrice = price self.Log("Buy @ " + str(self.entryTicket.AverageFillPrice)) #Tailing Stopp Loss if price > self.highestPrice: self.highestPrice = price #Cut Losses if self.Portfolio.Invested and price <= self.fifty.Current.Value or (price < self.highestPrice * 0.95): self.Liquidate(self.symbol) self.Log("Sell @ " + str(price)) self.entryRisk = 0 self.highestPrice = 0 #self.Error("Cut Losses @ " + str(price)) def PlotChart(self): self.Plot("Benchmark", "Twenty", self.twenty.Current.Value) self.Plot("Benchmark", "Fifty", self.fifty.Current.Value) self.Plot("Benchmark", "Hundred", self.hundred.Current.Value) #self.Plot("RSI", "RSI", self.rsi.Current.Value) #self.Plot("RSI" , "Upper-Border", 80) #self.Plot("RSI" , "Lower-Border", 20)