This commit is contained in:
dsyoon
2023-10-22 22:42:21 +09:00
parent 8e1d06a6e0
commit b81344ae32
2 changed files with 78 additions and 8 deletions

View File

@@ -572,6 +572,68 @@ class Common:
return False
def check_optimal_buy_timeing(self, stock):
max_vol_5 = max(stock['volume'][0: 4])
max_vol_30 = max(stock['volume'][4: 24])
if max_vol_30 < max_vol_5:
if stock['open'][1] < stock['close'][1] and stock['volume'][1] < stock['volume'][0]:
# if stock['open'][i - 1] < stock['close'][i - 1] and stock['volume'][i - 1] < stock['volume'][i]:
# 1) 스토캐스틱 과매도
slow_k_buy = False
for idx in range(0, 10):
if stock['slow_k'][idx] < 20:
slow_k_buy = True
break
# 2) macd 교차 신호
macd_buy = False
if slow_k_buy:
for idx in range(0, 10):
if stock['macd'][idx+1] < 0 and stock['macds'][idx+1] < 0 and stock['macd'][idx] < 0 and stock['macds'][idx] < 0:
if stock['macd'][idx+1] < stock['macds'][idx+1] and stock['macd'][idx] > stock['macds'][idx]:
macd_buy = True
break
# 3) RSI 지수가 50위로 올라갈 때
if macd_buy:
if stock['rsi'][1] < 40 and stock['rsi'][0] > 40:
return True
if stock['close'][0] < stock['avg200'][0] and stock['open'][0] < stock['close'][0] and max(stock['avg5'][0], stock['avg20'][0], stock['avg200'][0]) < stock['avg60'][0]:
if stock['open'][0] < min(stock['close'][0], stock['avg5'][0], stock['avg20'][0], stock['avg60'][0], stock['avg120'][0]):
if max(stock['volume'][:10]) * 4 < stock['volume'][0]:
if stock['open'][0] < (stock['upper'][0] + stock['lower'][0]) / 2:
return True
if stock['avg200'][0] < stock['avg5'][0] and stock['avg200'][0] < stock['avg20'][0] and stock['avg200'][0] < stock['avg60'][0]:
if stock['open'][0] < stock['close'][0]:
if max(stock['volume'][:10]) * 3 < stock['volume'][0]:
if max(stock['disparity_avg5'][0], stock['disparity_avg20'][0], stock['disparity_avg60'][0]) - min(stock['disparity_avg5'][0], stock['disparity_avg20'][0], stock['disparity_avg60'][0]) < 0.003:
return True
if stock['open'][1] < stock['close'][1] and stock['open'][0] < stock['close'][0]:
if stock['volume'][1] * 10 < stock['volume'][0]:
if stock['upper'][0] < stock['close'][0]:
if max(stock['disparity_avg5'][0], stock['disparity_avg20'][0], stock['disparity_avg60'][0]) - min(stock['disparity_avg5'][0], stock['disparity_avg20'][0], stock['disparity_avg60'][0]) < 0.005:
if max(stock['disparity_avg5'][0], stock['disparity_avg20'][0], stock['disparity_avg60'][0], stock['disparity_avg200'][0]) - min(stock['disparity_avg5'][0], stock['disparity_avg20'][0], stock['disparity_avg60'][0], stock['disparity_avg200'][0]) < 0.006:
if stock['avg200'][0] < min(stock['open'][0], stock['close'][0], stock['avg5'][0], stock['avg20'][0], stock['avg60'][0]):
return True
check = False
for c in range(10):
if stock['close'][c+1] < stock['close'][c+2] < stock['close'][c+3] < stock['close'][c+4] < stock['close'][c+5] < stock['close'][c+6]:
if stock['close'][c+1] < stock['lower'][c+1] and stock['close'][c+2] < stock['lower'][c+2] and stock['close'][c+3] < stock['lower'][c+3] and stock['close'][c+4] < stock['lower'][c+4] and stock['close'][c+5] < stock['lower'][c+5] and stock['close'][c+6] < stock['lower'][c+6]:
check = True
break
if check and stock['close'][0] < stock['lower'][0]:
return True
return False
# 낙폭 과대 체크
def check_excessive_drop(self, stock):
c_index = 200
@@ -589,9 +651,9 @@ class Common:
return False
def check_under_BB_Low(self, stock):
if stock['bolingerband_lower'][0] is not None and stock['bolingerband_lower'][1] is not None:
if stock['lower'][0] is not None and stock['lower'][1] is not None:
# bb 하단에 부딪힘
if stock['close'][0] < stock['bolingerband_lower'][0]:
if stock['close'][0] < stock['lower'][0]:
return True
return False