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 -0.081 Tracking Error 0.062 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
class CalibratedDynamicComputer(QCAlgorithm): def Initialize(self): self.SetStartDate(2016, 1, 30) self.SetEndDate(2020, 1, 30) self.SetCash(10000) self.SetBrokerageModel(BrokerageName.OandaBrokerage) symbol = self.AddForex("EURUSD", Resolution.Daily, Market.Oanda).Symbol self.engulfing = self.CandlestickPatterns.Engulfing(symbol, Resolution.Daily) self.engulfing_window = RollingWindow[float](10) self.SetBenchmark("EURUSD") def OnData(self, data): if not self.engulfing.IsReady: return engulfing = self.engulfing.Current.Value # 0 if not ready or not engulfing, 1 if bullish engulf, -1 if bearish engulf #self.Plot("IndicatorValue", "Engulfing", engulfing) self.engulfing_window.Add(engulfing) if self.engulfing_window.IsReady: # changed your code for ready instead of not ready #self.Plot("TrailingIndicatorValue", "TrailingHammer", self.engulfing_window[self.engulfing_window.Count-1]) if self.engulfing_window[0] == 1 and self.engulfing_window[1] == 1: # invest if two bullish engulfs in a row, for the kick self.SetHoldings("EURUSD", 1) self.Log(f"self.engulfing_window: {[x for x in self.engulfing_window]}")