添加三类买卖点识别和图上标注,还不错,感觉可以赚钱了,明天继续优化一下
This commit is contained in:
+6
-2
@@ -1,7 +1,7 @@
|
||||
import copy
|
||||
from typing import Dict, Optional
|
||||
|
||||
from ChanEnum import Chan_FX_TYPE, Chan_KLINE_DIR, Chan_BI_DIR, Chan_KLC_FX, Chan_K_DIR, Chan_MACD_STATE, Chan_PRICE_TREND, Chan_EMA_POS, Chan_EMA_SEMANTIC
|
||||
from ChanEnum import Chan_FX_TYPE, Chan_KLINE_DIR, Chan_BI_DIR, Chan_KLC_FX, Chan_K_DIR, Chan_MACD_STATE, Chan_PRICE_TREND, Chan_EMA_POS, Chan_EMA_SEMANTIC, Chan_BSP_TYPE
|
||||
import ChanKLU
|
||||
import ChanCTime
|
||||
|
||||
@@ -55,6 +55,7 @@ class ChanKLC():
|
||||
self.klc_dir = Chan_KLINE_DIR.UP if klu.close > klu.open else Chan_KLINE_DIR.DOWN
|
||||
self.ema_dir = klu.ema_dir
|
||||
self.bsp = False
|
||||
self.bsp_type = Chan_BSP_TYPE.NONE
|
||||
# EMA状态字典:key为EMA名称,value为 {'pos': Chan_EMA_POS, 'semantic': Chan_EMA_SEMANTIC}
|
||||
self.ema_status = {}
|
||||
# 向后兼容:保留 ema52_status 和 ema52_pos
|
||||
@@ -233,7 +234,10 @@ class ChanKLC():
|
||||
# threshold_pct: 阈值百分比,用于自动计算绝对阈值
|
||||
# 例如 0.001 表示 EMA 值的 0.1%,BTC $100,000 时 threshold = $100
|
||||
threshold_pct = 0.001
|
||||
|
||||
def set_bsp_type(self, bsp_type):
|
||||
if bsp_type and bsp_type != Chan_BSP_TYPE.NONE:
|
||||
self.bsp_type = bsp_type
|
||||
self.bsp = True
|
||||
def cal_all_ema_status(self):
|
||||
"""
|
||||
统一计算所有EMA与K线的位置关系和语义状态
|
||||
|
||||
Reference in New Issue
Block a user