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 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio 0 Tracking Error 0 Treynor Ratio 0 Total Fees $0.00 |
class ADXStrategy(QCAlgorithm): def Initialize(self): self.SetStartDate(2018, 1, 1) self.SetEndDate(2019, 6, 30) self.SetCash(100000) self.AAPL = self.AddEquity("AAPL", Resolution.Daily) self.ADX_Indicator = self.ADX("AAPL", 14, Resolution.Daily) self.SetWarmUp(14) self.Window = RollingWindow[TradeBar](5) self.Consolidate("AAPL", Resolution.Daily, self.TradeBarHandler); self.EMA_Indicator = self.EMA("AAPL", 20, Resolution.Daily) def TradeBarHandler(self, TradeBar): self.Window.Add(TradeBar); def OnData(self, data): self.PDI = self.ADX_Indicator.PositiveDirectionalIndex.Current.Value self.NDI = self.ADX_Indicator.NegativeDirectionalIndex.Current.Value self.ADXCV = self.ADX_Indicator.Current.Value self.EMACV = self.EMA_Indicator.Current.Value self.Debug("Apple Close: {} ADX: {} PDI: {} NDI: {} EMA: {}".format(self.AAPL.Close, self.ADXCV, self.PDI, self.NDI, self.EMACV))