Overall Statistics |
Total Trades 8 Average Win 11.09% Average Loss -12.00% Compounding Annual Return 20.566% Drawdown 18.900% Expectancy 0.443 Net Profit 20.628% Sharpe Ratio 0.964 Probabilistic Sharpe Ratio 45.294% Loss Rate 25% Win Rate 75% Profit-Loss Ratio 0.92 Alpha 0.097 Beta 0.331 Annual Standard Deviation 0.158 Annual Variance 0.025 Information Ratio -0.067 Tracking Error 0.226 Treynor Ratio 0.461 Total Fees $12.59 Estimated Strategy Capacity $700000000.00 Lowest Capacity Asset SPY R735QTJ8XC9X |
#region imports from AlgorithmImports import * #endregion class FormalFluorescentYellowArmadillo(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 1, 1) # Set Start Date self.SetEndDate(2021, 1, 1) # Set End Date self.SetCash(100000) # Set Strategy Cash spy = self.AddEquity("SPY", Resolution.Daily) # self.AddForex, self.AddFuture... spy.SetDataNormalizationMode(DataNormalizationMode.Raw) self.spy = spy.Symbol self.SetBenchmark("SPY") self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Margin) self.entryPrice = 0 self.period = timedelta(31) self.nextEntryTime = self.Time def OnData(self, data): if not self.spy in data: return # price = data.Bars[self.spy].Close price = data[self.spy].Close # price = self.Securities[self.spy].Close if not self.Portfolio.Invested: if self.nextEntryTime <= self.Time: self.SetHoldings(self.spy, 1) # self.MarketOrder(self.spy, int(self.Portfolio.Cash / price) ) self.Log("BUY SPY @" + str(price)) self.entryPrice = price elif self.entryPrice * 1.1 < price or self.entryPrice * 0.90 > price: self.Liquidate() self.Log("SELL SPY @" + str(price)) self.nextEntryTime = self.Time + self.period