def next(self): if len(self.data.Volume) > LOOK_BACK: prices = self.data.Close # if np.datetime64(self.data.Date[-1]) == np.datetime64('2018-01-29T00:00:00.000000000'): # t4 = jModel.isBearishEngulfing(self.data.Open, self.data.Close, self.data.High, self.data.Low, self.data.Body, self.data.Height, self.data.UpShadow, self.data.LowerShadow) # print('today - isBearishEngulfing - ' + str(t4)) # exit() the1stDayIsBlack = jModel.isBlackCandlestick( self.data.Open[-3], self.data.Close[-3]) isDownTrend = jModel.isDownTrendV1(self.data.Open, self.data.Close, self.data.High, self.data.Low, self.data.Body, self.data.Height, self.data.UpShadow, self.data.LowerShadow) the2ndDayIsDoji = jModel.isDoji(self.data.Body[-2], self.data.Height[-2]) todayIsShavenHead = jModel.isShavenHead(self.data.Height[-1], self.data.UpShadow[-1]) todayIsWhite = jModel.isWhiteCandlestick(self.data.Open[-1], self.data.Close[-1]) if isDownTrend is True and the2ndDayIsDoji is True and todayIsShavenHead is True and todayIsWhite is True: hasBuySignal = True else: hasBuySignal = False if hasBuySignal is not False: self.buy(sl=0.9 * prices[-1], tp=1.2 * prices[-1])
# print(ticker_data) # print(len(ticker_data.index)) # print(ticker_data[0:5]) # print(ticker_data.size) # exit() d2 = jModel.convertToJapanCandle(ticker_data) for index, row in d2.iterrows(): # print(row['Open']) # isHammer = jModel.isHammer(row['Open'], row['Close'], row['Body'], row['Height'], row['UpShadow'], row['LowerShadow']) # if isHammer is True: # print(index) if np.datetime64(row['Date']) == np.datetime64('2019-01-04T00:00:00.000000000'): isHammer = jModel.isDoji(row['Body'], row['Height']) print(isHammer) # last = 0 # np_ticker_data = ticker_data.to_numpy() # data_len = len(ticker_data.index) # for i in range(data_len): # if i > 2: # ii = i + 1 # data = ticker_data.head(ii) # k = data.copy().tail(4) # _4daysData = jModel.convertToJapanCandle(k) # isHangingMan = jModel.isHangingMan(_4daysData) # if isHangingMan is True: # print(np_ticker_data[i])