Overall Statistics |
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return -0.390% Drawdown 1.200% Expectancy 0 Net Profit -0.802% Sharpe Ratio -0.264 Probabilistic Sharpe Ratio 1.348% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.005 Beta 0.003 Annual Standard Deviation 0.01 Annual Variance 0 Information Ratio -1.544 Tracking Error 0.611 Treynor Ratio -0.974 Total Fees $0.70 Estimated Strategy Capacity $0 Lowest Capacity Asset USDTUSD 2MN |
class CalmLightBrownKitten(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 1, 1) self.SetEndDate(2022, 1, 21) self.SetCash(1000) self.crypto = self.AddCrypto("USDTUSD", Resolution.Minute, Market.FTX).Symbol self.SetBrokerageModel(BrokerageName.FTX, AccountType.Margin) self.roc = self.ROC(self.crypto, 6, Resolution.Hour) self.entryPrice = 0 self.nextEntryTime = self.Time self.period = timedelta(minutes = 240) self.nextEntryTime = self.Time self.SetWarmUp(6*60+1, Resolution.Minute) def OnData(self, data): if self.IsWarmingUp or not (self.nextEntryTime <= self.Time): return price = float(self.Securities[self.crypto].Close) roc = self.roc.Current.Value self.Plot(self.crypto, 'current price', price) self.Plot('ROC', 'roc', float(roc)) self.Plot('ROC', 'roc threshold', -0.01) if not self.Portfolio[self.crypto].Invested: if self.entryPrice == 0: if roc < -0.01: self.SetHoldings(self.crypto, 1.00) self.entryPrice = price elif self.Portfolio[self.crypto].Invested: if self.entryPrice > 0: if price >= self.entryPrice * 1.01: self.Liquidate(self.crypto, "Take Profit") self.entryPrice = 0 self.nextEntryTime = self.Time + self.period