This commit is contained in:
dosangyoon
2021-10-24 20:01:47 +09:00
parent 9df419be36
commit 7b87c1b56d
4 changed files with 136 additions and 20 deletions

View File

@@ -518,29 +518,22 @@ class Analyzer:
isbuy = 0
# 스토케스틱이 20이하이어야 하며, 볼린저밴드 0.3 보다 작으며, 위치에너지도 0.2보다 낮다면,
if stochastic_score < 30 and bolingerband_score < 0.3 and positionalEnergy < 0.5:
if stochastic_score < 30 and bolingerband_score < 0.3 and positionalEnergy < 0.3:
isbuy = 1
# 위치에너지가 낮거나 240일선 아래에 있는 상태에서 상태값을 갖는 경우 매수한다.
if state != "":
isbuy = 2
# 종가가 240일선 아래라면 매수한다.
if STOCK[last_index]['close'] < STOCK[last_index]['avg240']:
if state == "":
isbuy = 3
isbuy = 2
else:
isbuy = 4
isbuy = 3
if len(STOCK) > 5:
# 볼린저밴드 하단에 부딪혔다면,
"""
if (STOCK[last_index-2]['low'] <= BOLINGERBAND[last_index-2]['lower'] <= STOCK[last_index-2]['high'] or
STOCK[last_index-3]['low'] <= BOLINGERBAND[last_index-3]['lower'] <= STOCK[last_index-3]['high'] or
STOCK[last_index-4]['low'] <= BOLINGERBAND[last_index-4]['lower'] <= STOCK[last_index-4]['high']):
"""
if (STOCK[last_index - 2]['low'] <= BOLINGERBAND[last_index - 2]['lower'] <= STOCK[last_index - 2]['high'] or
STOCK[last_index - 3]['low'] <= BOLINGERBAND[last_index - 3]['lower'] <= STOCK[last_index - 3]['high']):
# 어제 양봉이거나
# 음봉이라면 그저깨 종가보다 어제 시가가 높거나 같고 그저깨 시가보다 어제 종가가 높다.
# 음봉이라면 그저깨 시가보다 어제 시가가 높거나 같고 그저깨 종가보다 어제 종가가 높다.
@@ -550,15 +543,25 @@ class Analyzer:
# (KOSPI: 2011년 8월 11일)
# 오늘 양봉이어야 한다.
if STOCK[last_index]['open'] < STOCK[last_index]['close']:
isbuy = 5
isbuy = 4
# (KOSPI: 2011년 9월 26일)
# 오늘 음봉이라면, 오늘 시가는 어제 종가보다 높아야 하고, 오늘 종가는 어제 시가보다 높아야 한다.
if (STOCK[last_index]['close'] < STOCK[last_index]['open']) and (STOCK[last_index-1]['close'] < STOCK[last_index]['open'] and STOCK[last_index-1]['open'] < STOCK[last_index]['close']):
isbuy = 5
if isbuy==4 and stochastic_score < 30 and bolingerband_score < 0.3 and positionalEnergy < 0.5:
if isbuy==5 and stochastic_score < 10 and bolingerband_score < 0.1 and positionalEnergy < 0.1:
isbuy = 6
if (STOCHASTIC[last_index]['slow_k'] < 30 and
STOCHASTIC[last_index-1]['slow_k'] < STOCHASTIC[last_index-1]['slow_d'] and
STOCHASTIC[last_index]['slow_d'] < STOCHASTIC[last_index]['slow_k']):
isbuy = 9
if (STOCHASTIC[last_index]['slow_k'] < 30 and
STOCHASTIC[last_index - 1]['slow_k'] < STOCHASTIC[last_index - 1]['slow_d'] and
STOCHASTIC[last_index]['slow_d'] < STOCHASTIC[last_index]['slow_k']):
isbuy = 8
fig = self.draw(stock)
title = "%s (%s), %s, buy_price (%d), stochastic(%.2f), bolingerband(%.2f), positionalEnergy(%.2f) 차트" % (item_name, item_code, state, buy_price, stochastic_score, bolingerband_score, positionalEnergy)
fig['layout'].update(title=title)