Overall Statistics |
Total Trades 1556 Average Win 0% Average Loss -0.01% Compounding Annual Return -99.901% Drawdown 6.700% Expectancy -1 Net Profit -6.712% Sharpe Ratio -16.562 Probabilistic Sharpe Ratio 0% Loss Rate 100% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.829 Beta -0.247 Annual Standard Deviation 0.06 Annual Variance 0.004 Information Ratio -5.543 Tracking Error 0.305 Treynor Ratio 4.054 Total Fees $2354.77 |
class NadionHorizontalFlange(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 7, 11) # Set Start Date self.SetCash(100000) # Set Strategy Cash self.AddEquity("SPY", Resolution.Minute) self.Schedule.On(self.DateRules.EveryDay("SPY"), self.TimeRules.BeforeMarketClose("SPY"), self.Liquidate) self.prev_profit = None def OnData(self, data): '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here. Arguments: data: Slice object keyed by symbol containing the stock data ''' if not self.Portfolio.Invested: self.SetHoldings("SPY", 1.0) if data.ContainsKey("SPY") and data["SPY"] is not None: if data["SPY"].Close + 1.5 > self.Portfolio["SPY"].AveragePrice: if self.prev_profit != self.Portfolio["SPY"].LastTradeProfit: self.Log("Profit" + str(self.Portfolio["SPY"].LastTradeProfit)) self.prev_profit = self.Portfolio["SPY"].LastTradeProfit self.Liquidate("SPY", "TAKE PROFIT") # tags are optional: self.Liquidate("SPY") also works