Overall Statistics |
Total Trades 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe Ratio 0 Probabilistic Sharpe Ratio 0% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio 0 Tracking Error 0 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
class StochMeanReverter(QCAlgorithm): # ================================================================================== def Initialize(self): self.InitAlgoParams() self.InitBacktestParams() # ================================================================================== def InitAlgoParams(self): self.symbol = "BTCUSD" self.SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash) self.AddCrypto(self.symbol, Resolution.Hour) self.smPriceWindow = SmartRollingWindow[float](4) # ================================================================== def InitBacktestParams(self): self.initCash = 100000 # todo: use this to track buy+hold self.SetStartDate(2021, 11, 1) # Set Start Date self.SetCash(self.initCash) # Set Strategy Cash self.SetBenchmark(self.symbol) # ============================================================================ def OnData(self, dataSlice): self.smPriceWindow.Add(dataSlice[self.symbol].Close ) hasAtLeast = self.smPriceWindow.hasAtLeast(3) return ################################################### # # Smart Rolling window # ======================== # Convenience class that extends RollingWindow # # Methods: # ------------------------- # mySmartWindow.IsRising() # mySmartWindow.IsFalling() # mySmartWindow.CrossesAbove(value) # mySmartWindow.CrossesBelow(value) # mySmartWindow.IsFlat(decimalPrecision) # mySmartWindow.hasAtLeastThisMany(value) # ################################################### class SmartRollingWindow(RollingWindow): ## Return True if rolling window has at least minCount many elements def hasAtLeast(self,minCount): # Do something here return False