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 -1.992 Tracking Error 0.135 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
# region imports from AlgorithmImports import * # endregion class Stochastic(QCAlgorithm): def Initialize(self): self.SetStartDate(2023, 1, 1) self.SetEndDate(datetime.now()) self.SetCash(10000) self.eq = self.AddEquity("SPY", Resolution.Minute).Symbol self.SetWarmUp(14 + 20 + 10) self.rsi = self.RSI(self.eq, 14, Resolution.Minute) self.stoch = self.STO(self.eq, 20) consolidator = self.Consolidate("SPY", timedelta(hours=4), self.consolidation_handler) self.RegisterIndicator("SPY", self.rsi, consolidator) def consolidation_handler(self, bar): if self.rsi.IsReady: rsi = self.rsi.Current.Value trade_bar = TradeBar(bar.EndTime, self.eq, rsi, rsi, rsi, rsi, 0) self.stoch.Update(trade_bar) self.Plot("Indicator", "StochRSI_FastK", self.stoch.FastStoch.Current.Value) self.Plot("Indicator", "StochRSI_SlowK", self.stoch.StochK.Current.Value) def OnData(self, data): if self.IsWarmingUp or not self.stoch: return