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 -2.439 Tracking Error 0.142 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
class TradeStrategyTest(QCAlgorithm): def Initialize(self): self.SetStartDate(2021,1, 1) #Set Start Date self.SetEndDate(2021,6,1) #Set End Date self.SetCash(10000) #Set Strategy Cash self.AddEquity("SPY", Resolution.Minute) self.SetWarmUp(14) self.RSI1 = self.RSI("SPY", 14, MovingAverageType.Simple, Resolution.Daily) self.previous_day_close = self.Securities["SPY"].Price self.expiry = self.Time def OnData(self, data): if self.IsWarmingUp or not data.Bars.ContainsKey("SPY") or not self.RSI1.IsReady: return if self.Time >= self.expiry: self.previous_day_close = data["SPY"].Close self.expiry = Expiry.EndOfDay(self.Time) self.previous_bar_close = data["SPY"].Close self.change_from_close = (self.previous_day_close - self.previous_bar_close) if not self.Securities["SPY"].Invested: if -10 >= self.change_from_close and self.change_from_close <= -4: self.MarketOrder("SPY", 1) else: if self.RSI1.Current.Value > 70: self.Liquidate()