This commit is contained in:
dsyoon
2023-11-22 00:32:17 +09:00
parent 7006be45fa
commit 65a15b657b

View File

@@ -574,38 +574,11 @@ class Common:
def check_optimal_buy_timeing(self, stock): def check_optimal_buy_timeing(self, stock):
min_macd = min(stock['macd']) / 2 if stock['avg120'][0] < stock['avg60'][0] < stock['avg20'][0] < stock['avg5'][0]:
if stock['avg240'][0] < stock['avg20'][0] < stock['avg5'][0]:
# 매수전략 #1: 깊은 하락 if stock['rsi'][0] < 70:
if (stock['macd'][0] < min_macd) and (stock['macdo'][1] <= 0 and 0 < stock['macdo'][0]):
if stock['close'][0] < stock['avg200'][0]:
return True
# 매수전략 #2: RSI 과매도 이후 골든크로스
if (stock['macd'][1] < stock['macds'][1] and stock['macds'][0] < stock['macd'][0]):
canBuy = False
if 13 < len(stock['rsi']):
for c in range(1, 12):
if stock['rsi'][c] < 10:
canBuy = True
break
if canBuy:
return True return True
# 매수전략 #3: 다이버전스
if (stock['macd'][1] < stock['macds'][1] and stock['macds'][0] < stock['macd'][0]):
canBuy = False
index = 0
if 41 < len(stock['rsi']):
for c in range(1, 41):
if stock['macd'][c+1] < stock['macds'][c+1] and stock['macds'][c] < stock['macd'][c]:
canBuy = True
index = c
break
if canBuy and stock['rsi'][index] < 30:
if (stock['macd'][index] < stock['macd'][0] and min(stock['open'][0], stock['close'][0]) < min(stock['open'][index], stock['close'][index])):
return True
return False return False