This commit is contained in:
dsyoon
2021-09-09 23:18:51 +09:00
parent 5ef4aca07c
commit bfee381f26

View File

@@ -514,13 +514,25 @@ class Analyzer:
if positionalEnergy < 0.2 or bolingerband_score < 0.2:
isbuy = 2
# 볼린저밴드 하단에 부딪힌 후 2개의 양봉을 보였으면, 매수한다.
if len(STOCK) > 5:
if STOCK[-1]['open'] < STOCK[-1]['close'] and STOCK[-2]['open'] < STOCK[-2]['close']:
if (STOCK[-3]['low'] <= BOLINGERBAND[-3]['lower'] <= STOCK[-3]['high'] or
STOCK[-4]['low'] <= BOLINGERBAND[-4]['lower'] <= STOCK[-4]['high'] or
STOCK[-5]['low'] <= BOLINGERBAND[-5]['lower'] <= STOCK[-5]['high']):
isbuy = 3
# 볼린저밴드 하단에 부딪혔다면,
if (STOCK[-3]['low'] <= BOLINGERBAND[-3]['lower'] <= STOCK[-3]['high'] or
STOCK[-4]['low'] <= BOLINGERBAND[-4]['lower'] <= STOCK[-4]['high'] or
STOCK[-5]['low'] <= BOLINGERBAND[-5]['lower'] <= STOCK[-5]['high']):
# 어제 양봉이거나
# 음봉이라면 그저깨 종가보다 어제 시가가 높거나 같고 그저깨 시가보다 어제 종가가 높다.
# 음봉이라면 그저깨 시가보다 어제 시가가 높거나 같고 그저깨 종가보다 어제 종가가 높다.
if STOCK[-2]['open'] < STOCK[-2]['close'] or (
(STOCK[-3]['close'] <= STOCK[-2]['open'] and STOCK[-3]['open'] < STOCK[-2]['close']) or
(STOCK[-3]['open'] <= STOCK[-2]['open'] and STOCK[-3]['close'] < STOCK[-2]['close'])):
# (KOSPI: 2011년 8월 11일)
# 오늘 양봉이어야 한다.
if STOCK[-1]['open'] < STOCK[-1]['close']:
isbuy = 3
# (KOSPI: 2011년 9월 26일)
# 오늘 음봉이라면, 오늘 시가는 어제 종가보다 높아야 하고, 오늘 종가는 어제 시가보다 높아야 한다.
if (STOCK[-1]['close'] < STOCK[-1]['open']) and (STOCK[-2]['close'] < STOCK[-1]['open'] and STOCK[-2]['open'] < STOCK[-1]['close']):
isbuy = 3
if isbuy >= 3 and state != "":
isbuy = 4