This commit is contained in:
dsyoon
2023-11-08 23:08:48 +09:00
parent 5ec0d59072
commit c14c71de43

View File

@@ -579,37 +579,32 @@ class Common:
# 매수전략 #1: 깊은 하락 # 매수전략 #1: 깊은 하락
if (stock['macd'][0] < min_macd) and (stock['macdo'][1] <= 0 and 0 < stock['macdo'][0]): if (stock['macd'][0] < min_macd) and (stock['macdo'][1] <= 0 and 0 < stock['macdo'][0]):
if stock['close'][0] < stock['avg200'][0]: if stock['close'][0] < stock['avg200'][0]:
weight = 0.5 return True
buy = stock['close'][0]
type = 'method1'
# 매수전략 #2: RSI 과매도 이후 골든크로스 # 매수전략 #2: RSI 과매도 이후 골든크로스
if (stock['macd'][1] < stock['macds'][1] and stock['macds'][0] < stock['macd'][0]): if (stock['macd'][1] < stock['macds'][1] and stock['macds'][0] < stock['macd'][0]):
canBuy = False canBuy = False
if 10 < len(stock['rsi']):
for c in range(1, 11): for c in range(1, 11):
if stock['rsi'][0 - c] < 10: if stock['rsi'][0 - c] < 10:
canBuy = True canBuy = True
break break
if canBuy: if canBuy:
weight = 3 return True
buy = stock['close'][0]
type = 'method2'
# 매수전략 #3: 다이버전스 # 매수전략 #3: 다이버전스
if (stock['macd'][1] < stock['macds'][1] and stock['macds'][0] < stock['macd'][0]): if (stock['macd'][1] < stock['macds'][1] and stock['macds'][0] < stock['macd'][0]):
canBuy = False canBuy = False
index = 0 index = 0
if 41 < len(stock['rsi']):
for c in range(1, 41): for c in range(1, 41):
if stock['macd'][0 - c - 1] < stock['macds'][0 - c - 1] and stock['macds'][0 - c] < stock['macd'][0 - c]: if stock['macd'][0 - c - 1] < stock['macds'][0 - c - 1] and stock['macds'][0 - c] < stock['macd'][0 - c]:
canBuy = True canBuy = True
index = c index = c
break break
if canBuy and stock['rsi'][0 - index] < 30: if canBuy and stock['rsi'][0 - index] < 30:
if (stock['macd'][0 - index] < stock['macd'][0] and if (stock['macd'][0 - index] < stock['macd'][0] and min(stock['open'][0], stock['close'][0]) < min(stock['open'][0 - index], stock['close'][0 - index])):
min(stock['open'][0], stock['close'][0]) < min(stock['open'][0 - index], stock['close'][0 - index])): return True
weight = 2
buy = stock['close'][0]
type = 'method3'
return False return False