diff --git a/stockpredictor/analysis/Analyzer.py b/stockpredictor/analysis/Analyzer.py index 7cd394a..1428f68 100644 --- a/stockpredictor/analysis/Analyzer.py +++ b/stockpredictor/analysis/Analyzer.py @@ -512,13 +512,18 @@ class Analyzer: state, buy_price = self.analyzeFinalScore(last_index, STOCK, STOCHASTIC) isbuy = 0 - # 종가가 240일선 아래에 있으면 매수한다. - if isbuy > 0 and STOCK[last_index]['close'] < STOCK[last_index]['avg240']: - isbuy = 1 - # 위치에너지 < 0.4 and 볼린저밴드 < 0.3 이어야 한다. - if positionalEnergy < 0.2 or bolingerband_score < 0.2: - isbuy = 2 + if stochastic_score < 30 and bolingerband_score < 0.3: + # 종가가 240일선 아래에 있으면 매수한다. + if isbuy > 0 and STOCK[last_index]['close'] < STOCK[last_index]['avg240']: + isbuy = 1 + + # 위치에너지 < 0.4 and 볼린저밴드 < 0.3 이어야 한다. + if positionalEnergy < 0.2 or bolingerband_score < 0.2: + isbuy = 2 + + if isbuy > 0 and state != "": + isbuy = 3 if len(STOCK) > 5: # 볼린저밴드 하단에 부딪혔다면, @@ -540,9 +545,6 @@ class Analyzer: 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 = 9 - if isbuy >= 3 and state != "": - isbuy = 4 - 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)