Overall Statistics |
Total Trades 1528 Average Win 0.14% Average Loss -0.07% Compounding Annual Return 32.671% Drawdown 3.100% Expectancy 0.074 Net Profit 3.681% Sharpe Ratio 3.094 Probabilistic Sharpe Ratio 70.946% Loss Rate 65% Win Rate 35% Profit-Loss Ratio 2.03 Alpha 0.002 Beta 0.703 Annual Standard Deviation 0.118 Annual Variance 0.014 Information Ratio -2.223 Tracking Error 0.068 Treynor Ratio 0.517 Total Fees $2018.31 |
class VirtualApricotBee(QCAlgorithm): def Initialize(self): self.SetStartDate(2021, 1, 1) # Set Start Date self.SetCash(100000) # Set Strategy Cash self.symbol = self.AddEquity("SPY", Resolution.Minute).Symbol self.window = RollingWindow[TradeBar](5) def OnData(self, data): self.window.Add(data[self.symbol]) if not self.window.IsReady: return green_candles = 0 for candle in self.window: green_candles += int(candle.Open < candle.Close) if green_candles >= 2: self.SetHoldings(self.symbol, 1) else: self.SetHoldings(self.symbol, 0)