diff --git a/ChanLun.py b/ChanLun.py
index 421b923..1c3dbe3 100644
--- a/ChanLun.py
+++ b/ChanLun.py
@@ -718,7 +718,7 @@ class ChanLun():
if last_top.index + 4 < klc.index and len(bi_list) > 1:
pre_last_bi = bi_list[-2]
last_bi = bi_list[-1]
- if pre_last_bi.is_sure and not last_bi.is_sure and pre_last_bi.dir == Chan_BI_DIR.UP and False:
+ if pre_last_bi.is_sure and not last_bi.is_sure and pre_last_bi.dir == Chan_BI_DIR.UP:
pre_last_bi.update_bi(klc)
bi_list.remove(last_bi)
pre_last_bi.set_next(None)
@@ -838,7 +838,7 @@ class ChanLun():
if last_bottom.index + 4 < klc.index and len(bi_list) > 1:
pre_last_bi = bi_list[-2]
last_bi = bi_list[-1]
- if pre_last_bi.is_sure and not last_bi.is_sure and pre_last_bi.dir == Chan_BI_DIR.DOWN and False:
+ if pre_last_bi.is_sure and not last_bi.is_sure and pre_last_bi.dir == Chan_BI_DIR.DOWN:
pre_last_bi.update_bi(klc)
bi_list.remove(last_bi)
pre_last_bi.set_next(None)
diff --git a/__pycache__/ChanLun.cpython-312.pyc b/__pycache__/ChanLun.cpython-312.pyc
index 334f149..83849fa 100644
Binary files a/__pycache__/ChanLun.cpython-312.pyc and b/__pycache__/ChanLun.cpython-312.pyc differ
diff --git a/web/app.py b/web/app.py
index 7ee9b95..c5298c3 100644
--- a/web/app.py
+++ b/web/app.py
@@ -353,6 +353,22 @@ def analyze_chan(df):
for bi in bi_list:
bi.cal_macd_div()
#print(bi.start_time, bi.macd_hist, bi.macd_div)
+
+ # 获取原始K线数据用于KLU分型分析
+ klu_list = []
+ try:
+ # 尝试获取KLU数据
+ if hasattr(chan, 'get_klu_list'):
+ klu_list = chan.get_klu_list(df)
+ elif hasattr(chan, 'klu_list'):
+ klu_list = chan.klu_list
+ else:
+ # 如果没有专门的KLU方法,尝试从KLC获取原始K线数据
+ print("未找到KLU数据获取方法,尝试其他方式")
+ except Exception as e:
+ print(f"获取KLU数据时出错: {e}")
+ klu_list = []
+
# 提取K线分型信息
klc_fx_info = []
for klc in klc_list:
@@ -403,13 +419,74 @@ def analyze_chan(df):
'is_strong_fx': False
})
+ # 提取KLU分型信息
+ klu_fx_info = []
+ for klu in klu_list:
+ if hasattr(klu, 'fx_type') and klu.fx_type != Chan_FX_TYPE.UNKNOWN:
+ try:
+ # 计算分型强度
+ fx_strength = 0
+ fx_strength_level = ""
+ is_strong_fx = False
+
+ # 尝试调用分型强度计算方法
+ if hasattr(klu, 'calculate_realtime_fx_strength'):
+ fx_strength = klu.calculate_realtime_fx_strength()
+ elif hasattr(klu, 'fx_strength'):
+ fx_strength = klu.fx_strength
+
+ # 尝试获取分型强度等级 - 基于强度值生成等级
+ if fx_strength >= 2:
+ fx_strength_level = "强"
+ is_strong_fx = True
+ elif fx_strength >= 1:
+ fx_strength_level = "中"
+ is_strong_fx = False
+ elif fx_strength >= 0:
+ fx_strength_level = "弱"
+ is_strong_fx = False
+ else:
+ fx_strength_level = "极弱"
+ is_strong_fx = False
+
+ # 确保分型确认状态
+ is_confirmed = getattr(klu, 'fx_confirmed', True)
+
+ klu_fx_info.append({
+ 'time': klu.time,
+ 'price': klu.low if klu.fx_type == Chan_FX_TYPE.BOTTOM else klu.high,
+ 'fx_type': str(klu.fx_type).replace("Chan_FX_TYPE.", ""),
+ 'is_bottom': klu.fx_type == Chan_FX_TYPE.BOTTOM,
+ 'fx_strength': fx_strength, # 分型强度分数
+ 'fx_strength_level': fx_strength_level, # 分型强度等级
+ 'is_strong_fx': is_strong_fx, # 是否为强分型
+ 'fx_confirmed': is_confirmed # 分型是否确认
+ })
+ except Exception as e:
+ print(f"处理KLU分型信息时出错: {e}")
+ # 如果出错,仍然添加基本信息,但分型强度为0
+ klu_fx_info.append({
+ 'time': klu.time,
+ 'price': klu.low if klu.fx_type == Chan_FX_TYPE.BOTTOM else klu.high,
+ 'fx_type': str(klu.fx_type).replace("Chan_FX_TYPE.", ""),
+ 'is_bottom': klu.fx_type == Chan_FX_TYPE.BOTTOM,
+ 'fx_strength': 0,
+ 'fx_strength_level': "",
+ 'is_strong_fx': False,
+ 'fx_confirmed': False
+ })
+
+ print(f"提取到 {len(klc_fx_info)} 个KLC分型和 {len(klu_fx_info)} 个KLU分型")
+
return {
'klc_list': klc_list,
+ 'klu_list': klu_list, # 添加KLU列表
'bi_list': bi_list,
'seg_list': seg_list,
'zs_list': zs_list,
'trade_points': buy_sell_points,
- 'klc_fx_info': klc_fx_info # 添加分型信息
+ 'klc_fx_info': klc_fx_info, # KLC分型信息
+ 'klu_fx_info': klu_fx_info # 添加KLU分型信息
}
def identify_trade_points(bi_list, seg_list, zs_list):
@@ -687,7 +764,17 @@ def analyze():
'fx_strength': float(point['fx_strength']), # 分型强度分数
'fx_strength_level': str(point['fx_strength_level']), # 分型强度等级
'is_strong_fx': bool(point['is_strong_fx']) # 是否为强分型
- } for point in analysis_result['klc_fx_info']]
+ } for point in analysis_result['klc_fx_info']],
+ 'klu_fx_info': [{
+ 'time': format_time_safely(point['time'], client_tz),
+ 'price': float(point['price']),
+ 'fx_type': point['fx_type'],
+ 'is_bottom': bool(point['is_bottom']),
+ 'fx_strength': float(point['fx_strength']), # 分型强度分数
+ 'fx_strength_level': str(point['fx_strength_level']), # 分型强度等级
+ 'is_strong_fx': bool(point['is_strong_fx']), # 是否为强分型
+ 'fx_confirmed': bool(point['fx_confirmed']) # 分型是否确认
+ } for point in analysis_result['klu_fx_info']]
})
else:
print(f"只请求元素数据,跳过主周期数据处理 (elements_only={elements_only})")
@@ -780,6 +867,17 @@ def analyze():
'is_strong_fx': bool(point['is_strong_fx']) # 是否为强分型
} for point in element_analysis['klc_fx_info']]
+ result['element_klu_fx_info'] = [{
+ 'time': format_time_safely(point['time'], client_tz),
+ 'price': float(point['price']),
+ 'fx_type': point['fx_type'],
+ 'is_bottom': bool(point['is_bottom']),
+ 'fx_strength': float(point['fx_strength']), # 分型强度分数
+ 'fx_strength_level': str(point['fx_strength_level']), # 分型强度等级
+ 'is_strong_fx': bool(point['is_strong_fx']), # 是否为强分型
+ 'fx_confirmed': bool(point['fx_confirmed']) # 分型是否确认
+ } for point in element_analysis['klu_fx_info']]
+
print(f"小周期分析完成: {element_timeframe}, 笔数量: {len(result['element_bi_list'])}, {'仅元素数据' if elements_only else '包含主周期数据'}")
else:
print(f"无法获取小周期数据: {element_timeframe}")
diff --git a/web/templates/index.html b/web/templates/index.html
index b95bc6b..e79cd94 100644
--- a/web/templates/index.html
+++ b/web/templates/index.html
@@ -397,7 +397,11 @@
-
+
+
+
+
+
@@ -411,7 +415,7 @@
-
+
@@ -428,7 +432,11 @@
-
+
+
+
+
+
@@ -1080,6 +1088,8 @@
console.log('- 显示成交量:', false);
console.log('- 显示分型类型:', $('#showKlcFxType').is(':checked'));
console.log('- 显示小周期分型:', $('#showElementKlcFxType').is(':checked'));
+ console.log('- 显示KLU分型:', $('#showKluFxType').is(':checked'));
+ console.log('- 显示小周期KLU分型:', $('#showElementKluFxType').is(':checked'));
console.log('- 显示买卖点:', $('#showTradePoints').is(':checked'));
console.log('- 显示原始K线:', $('#showOriginalKline').is(':checked'));
console.log('- 显示主周期布林带:', $('#showMainBollinger').is(':checked'));
@@ -3187,19 +3197,25 @@
// 绘制分型类型标签
console.log('=== 开始检查分型显示条件 ===');
console.log('showKlcFxType勾选状态:', $('#showKlcFxType').is(':checked'));
+ console.log('showKluFxType勾选状态:', $('#showKluFxType').is(':checked'));
console.log('currentData.klc_fx_info存在:', !!currentData.klc_fx_info);
+ console.log('currentData.klu_fx_info存在:', !!currentData.klu_fx_info);
console.log('currentData.klc_fx_info长度:', currentData.klc_fx_info ? currentData.klc_fx_info.length : 'undefined');
+ console.log('currentData.klu_fx_info长度:', currentData.klu_fx_info ? currentData.klu_fx_info.length : 'undefined');
if (currentData.klc_fx_info && currentData.klc_fx_info.length > 0) {
- console.log('前3个分型数据样本:', currentData.klc_fx_info.slice(0, 3));
+ console.log('前3个klc分型数据样本:', currentData.klc_fx_info.slice(0, 3));
+ }
+ if (currentData.klu_fx_info && currentData.klu_fx_info.length > 0) {
+ console.log('前3个klu分型数据样本:', currentData.klu_fx_info.slice(0, 3));
}
+ // 收集所有主周期分型标记
+ const allMainFxMarkers = [];
+ const mainFxMarkers = []; // 用于tooltip支持
+
+ // 处理主周期KLC分型
if ($('#showKlcFxType').is(':checked') && currentData.klc_fx_info && currentData.klc_fx_info.length > 0) {
- console.log(`绘制K线分型类型标签,共${currentData.klc_fx_info.length}条`);
-
- // 收集所有分型标记
- const allFxMarkers = [];
- // 存储分型标记,用于tooltip功能
- const fxMarkers = [];
+ console.log(`绘制主周期K线合并分型标签,共${currentData.klc_fx_info.length}条`);
currentData.klc_fx_info.forEach(function(fx) {
try {
@@ -3207,18 +3223,8 @@
const timestamp = Math.floor(new Date(fx.time).getTime() / 1000);
const price = parseFloat(fx.price);
- // 添加时间和价格调试信息
- console.log('处理分型:', {
- 原始时间: fx.time,
- 转换时间戳: timestamp,
- 原始价格: fx.price,
- 转换价格: price,
- 时间有效: !isNaN(timestamp),
- 价格有效: !isNaN(price)
- });
-
if (isNaN(timestamp) || isNaN(price)) {
- console.error('分型类型时间或价格转换错误:', fx.time, fx.price);
+ console.error('主周期KLC分型时间或价格转换错误:', fx.time, fx.price);
return;
}
@@ -3233,38 +3239,28 @@
}
// 构建显示文本,包含分型类型和强度信息
- // 添加调试信息
- console.log('分型数据:', {
- fx_type: fx.fx_type,
- fx_strength: fx.fx_strength,
- fx_strength_level: fx.fx_strength_level,
- is_strong_fx: fx.is_strong_fx
- });
- let displayText = `${fx.fx_strength_level} ${fx.fx_strength.toFixed(1)}`;
- if (fx.fx_strength < 1.0) { // 降低阈值,让更多分型显示
+ let displayText = `${fx.fx_strength.toFixed(1)}`;
+ if (fx.fx_strength < 1.5) { // 降低阈值,让更多分型显示
displayText = fx.fx_strength >= 0.8 ? '•' : '' // 0.8以上显示点,0.8以下不显示文本
}
- console.log('显示文本:', displayText);
- // 添加标记配置调试
+ // 添加标记配置
const markerConfig = {
time: timestamp,
position: fx.is_bottom ? 'belowBar' : 'aboveBar',
color: strengthColor,
- shape: 'circle',
+ shape: 'triangle',
text: displayText,
size: fx.is_strong_fx ? 1 : 0.6 // 调整尺寸,强分型稍大,普通分型更小
};
- console.log('标记配置:', markerConfig);
- // 添加到标记数组
- allFxMarkers.push(markerConfig);
+ allMainFxMarkers.push(markerConfig);
// 创建分型标记对象,包含tooltip信息
const fxMarker = {
time: timestamp,
tooltip: `
- ${fx.is_bottom ? '底分型' : '顶分型'}: ${fx.fx_type}
+ 主周期${fx.is_bottom ? '底分型' : '顶分型'}(合): ${fx.fx_type}
强度分数: ${fx.fx_strength}分
强度等级: ${fx.fx_strength_level}
是否强分型: ${fx.is_strong_fx ? '是' : '否'}
@@ -3273,87 +3269,62 @@
`
};
- // 添加到分型标记数组
- fxMarkers.push(fxMarker);
+ mainFxMarkers.push(fxMarker);
} catch (e) {
- console.error('绘制分型类型标签出错:', e);
+ console.error('绘制主周期KLC分型标签出错:', e);
}
});
-
- // 一次性设置所有分型标记到主数据系列
- if (allFxMarkers.length > 0) {
- console.log('一次性设置', allFxMarkers.length, '个分型标记');
-
- // 暂存主周期分型标记,等待与小周期合并
- window.mainFxMarkers = allFxMarkers;
- } else {
- window.mainFxMarkers = [];
- }
-
- // 将分型标记添加到全局markers中以支持tooltip功能
- if (window.fxMarkers) {
- window.fxMarkers = [...window.fxMarkers, ...fxMarkers];
- } else {
- window.fxMarkers = fxMarkers;
- }
-
- } else {
- console.log('绘制分型类型标签 - 已禁用或无数据');
- // 清空分型标记
- window.fxMarkers = [];
- window.mainFxMarkers = [];
}
- // 绘制小周期分型标记
- if ($('#showElementKlcFxType').is(':checked') && currentData.element_klc_fx_info && currentData.element_klc_fx_info.length > 0) {
- console.log(`绘制小周期分型标记,共${currentData.element_klc_fx_info.length}条`);
+ // 处理主周期KLU分型
+ if ($('#showKluFxType').is(':checked') && currentData.klu_fx_info && currentData.klu_fx_info.length > 0) {
+ console.log(`绘制主周期K线未合并分型标签,共${currentData.klu_fx_info.length}条`);
- // 收集所有小周期分型标记
- const allElementFxMarkers = [];
- const elementFxMarkers = []; // 用于tooltip支持
-
- currentData.element_klc_fx_info.forEach(function(fx) {
+ currentData.klu_fx_info.forEach(function(fx) {
try {
// 直接使用UTC时间戳(秒)
const timestamp = Math.floor(new Date(fx.time).getTime() / 1000);
const price = parseFloat(fx.price);
if (isNaN(timestamp) || isNaN(price)) {
- console.error('小周期分型时间或价格转换错误:', fx.time, fx.price);
+ console.error('主周期KLU分型时间或价格转换错误:', fx.time, fx.price);
return;
}
- // 小周期分型使用不同的颜色和样式,与主周期区分
- let strengthColor = fx.is_bottom ? '#FF6B6B' : '#4ECDC4'; // 底分型用珊瑚红,顶分型用薄荷绿
+ // KLU分型使用不同的颜色区分
+ const color = fx.is_bottom ? '#17a2b8' : '#fd7e14'; // 底分型用青色,顶分型用橙色
+
+ // 根据强度等级调整颜色强度
+ let strengthColor = color;
if (fx.is_strong_fx) {
// 强分型使用更亮的颜色
- strengthColor = fx.is_bottom ? '#FF0000' : '#00CED1';
+ strengthColor = fx.is_bottom ? '#20c997' : '#fd7e14';
}
- let displayText = `${fx.fx_strength_level} ${fx.fx_strength.toFixed(1)}`;
- // 构建小周期分型显示文本
- if (fx.fx_strength < 0.8){ // 调整小周期阈值
- displayText = fx.fx_strength >= 0.6 ? '•' : '' // 0.6以上显示点
+
+ // 构建显示文本,包含分型类型和强度信息
+ let displayText = `${fx.fx_strength.toFixed(1)}`;
+ if (fx.fx_strength < 1.4) { // 降低阈值,让更多分型显示
+ displayText = fx.fx_strength >= 0.8 ? '•' : '' // 0.8以上显示点,0.8以下不显示文本
}
-
- // 小周期分型标记配置 - 根据分型类型使用正确的箭头形状
+
+ // 添加标记配置
const markerConfig = {
time: timestamp,
position: fx.is_bottom ? 'belowBar' : 'aboveBar',
color: strengthColor,
- shape: 'circle',
+ // shape: 'triangle', // 使用三角形区分KLU分型
text: displayText,
- size: fx.is_strong_fx ? 0.8 : 0.6 // 小周期标记整体更小一些
+ size: fx.is_strong_fx ? 0.8 : 0.5 // KLU分型稍小一些
};
- console.log('小周期分型标记配置:', markerConfig);
- allElementFxMarkers.push(markerConfig);
+ allMainFxMarkers.push(markerConfig);
- // 创建小周期分型标记对象,包含tooltip信息
- const elementFxMarker = {
+ // 创建分型标记对象,包含tooltip信息
+ const fxMarker = {
time: timestamp,
tooltip: `
- 小周期${fx.is_bottom ? '底分型' : '顶分型'}: ${fx.fx_type}
+ 主周期${fx.is_bottom ? '底分型' : '顶分型'}(原): ${fx.fx_type}
强度分数: ${fx.fx_strength}分
强度等级: ${fx.fx_strength_level}
是否强分型: ${fx.is_strong_fx ? '是' : '否'}
@@ -3362,13 +3333,162 @@
`
};
- // 添加到小周期分型标记数组
- elementFxMarkers.push(elementFxMarker);
+ mainFxMarkers.push(fxMarker);
} catch (e) {
- console.error('绘制小周期分型标记出错:', e);
+ console.error('绘制主周期KLU分型标签出错:', e);
}
});
+ }
+
+ // 暂存主周期分型标记
+ window.mainFxMarkers = allMainFxMarkers;
+
+ // 将分型标记添加到全局markers中以支持tooltip功能
+ if (window.fxMarkers) {
+ window.fxMarkers = [...window.fxMarkers, ...mainFxMarkers];
+ } else {
+ window.fxMarkers = mainFxMarkers;
+ }
+
+ // 检查是否有任何主周期分型数据
+ const hasMainFxData = ($('#showKlcFxType').is(':checked') && currentData.klc_fx_info && currentData.klc_fx_info.length > 0) ||
+ ($('#showKluFxType').is(':checked') && currentData.klu_fx_info && currentData.klu_fx_info.length > 0);
+
+ if (!hasMainFxData) {
+ console.log('绘制主周期分型标记 - 已禁用或无数据');
+ // 清空主周期分型标记
+ window.mainFxMarkers = [];
+ window.fxMarkers = [];
+ }
+
+ // 绘制小周期分型标记
+ if (($('#showElementKlcFxType').is(':checked') && currentData.element_klc_fx_info && currentData.element_klc_fx_info.length > 0) ||
+ ($('#showElementKluFxType').is(':checked') && currentData.element_klu_fx_info && currentData.element_klu_fx_info.length > 0)) {
+
+ // 收集所有小周期分型标记
+ const allElementFxMarkers = [];
+ const elementFxMarkers = []; // 用于tooltip支持
+
+ // 处理小周期KLC分型
+ if ($('#showElementKlcFxType').is(':checked') && currentData.element_klc_fx_info && currentData.element_klc_fx_info.length > 0) {
+ console.log(`绘制小周期K线合并分型标记,共${currentData.element_klc_fx_info.length}条`);
+
+ currentData.element_klc_fx_info.forEach(function(fx) {
+ try {
+ // 直接使用UTC时间戳(秒)
+ const timestamp = Math.floor(new Date(fx.time).getTime() / 1000);
+ const price = parseFloat(fx.price);
+
+ if (isNaN(timestamp) || isNaN(price)) {
+ console.error('小周期KLC分型时间或价格转换错误:', fx.time, fx.price);
+ return;
+ }
+
+ // 小周期分型使用不同的颜色和样式,与主周期区分
+ let strengthColor = fx.is_bottom ? '#FF6B6B' : '#4ECDC4'; // 底分型用珊瑚红,顶分型用薄荷绿
+ if (fx.is_strong_fx) {
+ // 强分型使用更亮的颜色
+ strengthColor = fx.is_bottom ? '#FF0000' : '#00CED1';
+ }
+ let displayText = `${fx.fx_strength.toFixed(1)}`;
+ // 构建小周期分型显示文本
+ if (fx.fx_strength < 1.5){ // 调整小周期阈值
+ displayText = fx.fx_strength >= 0.6 ? '•' : '' // 0.6以上显示点
+ }
+
+ // 小周期分型标记配置
+ const markerConfig = {
+ time: timestamp,
+ position: fx.is_bottom ? 'belowBar' : 'aboveBar',
+ color: strengthColor,
+ shape: 'triangle',
+ text: displayText,
+ size: fx.is_strong_fx ? 0.8 : 0.6 // 小周期标记整体更小一些
+ };
+
+ allElementFxMarkers.push(markerConfig);
+
+ // 创建小周期分型标记对象,包含tooltip信息
+ const elementFxMarker = {
+ time: timestamp,
+ tooltip: `
+ 小周期${fx.is_bottom ? '底分型' : '顶分型'}(合): ${fx.fx_type}
+ 强度分数: ${fx.fx_strength}分
+ 强度等级: ${fx.fx_strength_level}
+ 是否强分型: ${fx.is_strong_fx ? '是' : '否'}
+ 价格: ${price.toFixed(4)}
+ 时间: ${fx.time}
+
`
+ };
+
+ elementFxMarkers.push(elementFxMarker);
+
+ } catch (e) {
+ console.error('绘制小周期KLC分型标记出错:', e);
+ }
+ });
+ }
+
+ // 处理小周期KLU分型
+ if ($('#showElementKluFxType').is(':checked') && currentData.element_klu_fx_info && currentData.element_klu_fx_info.length > 0) {
+ console.log(`绘制小周期K线未合并分型标记,共${currentData.element_klu_fx_info.length}条`);
+
+ currentData.element_klu_fx_info.forEach(function(fx) {
+ try {
+ // 直接使用UTC时间戳(秒)
+ const timestamp = Math.floor(new Date(fx.time).getTime() / 1000);
+ const price = parseFloat(fx.price);
+
+ if (isNaN(timestamp) || isNaN(price)) {
+ console.error('小周期KLU分型时间或价格转换错误:', fx.time, fx.price);
+ return;
+ }
+
+ // 小周期KLU分型使用不同的颜色
+ let strengthColor = fx.is_bottom ? '#9A8C98' : '#F2CC8F'; // 底分型用灰紫色,顶分型用浅黄色
+ if (fx.is_strong_fx) {
+ // 强分型使用更亮的颜色
+ strengthColor = fx.is_bottom ? '#6C5B7B' : '#F9844A';
+ }
+ let displayText = `${fx.fx_strength.toFixed(1)}`;
+ // 构建小周期分型显示文本
+ if (fx.fx_strength < 1.4){ // 调整小周期阈值
+ displayText = fx.fx_strength >= 0.6 ? '•' : '' // 0.6以上显示点
+ }
+
+ // 小周期KLU分型标记配置
+ const markerConfig = {
+ time: timestamp,
+ position: fx.is_bottom ? 'belowBar' : 'aboveBar',
+ color: strengthColor,
+ // shape: 'triangle', // 使用三角形区分KLU分型
+ text: displayText,
+ size: fx.is_strong_fx ? 0.7 : 0.5 // 小周期KLU标记更小一些
+ };
+
+ allElementFxMarkers.push(markerConfig);
+
+ // 创建小周期分型标记对象,包含tooltip信息
+ const elementFxMarker = {
+ time: timestamp,
+ tooltip: `
+ 小周期${fx.is_bottom ? '底分型' : '顶分型'}(原): ${fx.fx_type}
+ 强度分数: ${fx.fx_strength}分
+ 强度等级: ${fx.fx_strength_level}
+ 是否强分型: ${fx.is_strong_fx ? '是' : '否'}
+ 价格: ${price.toFixed(4)}
+ 时间: ${fx.time}
+
`
+ };
+
+ elementFxMarkers.push(elementFxMarker);
+
+ } catch (e) {
+ console.error('绘制小周期KLU分型标记出错:', e);
+ }
+ });
+ }
// 将小周期分型标记添加到全局markers中以支持tooltip功能
if (window.fxMarkers) {
@@ -3411,6 +3531,14 @@
} else {
console.log('未找到主数据系列,无法设置标记');
}
+ } else {
+ console.log('没有分型标记需要显示,清空图表标记');
+ // 清空图表上的所有标记
+ if (showOriginalKline && tvWidget.series.candleSeries) {
+ tvWidget.series.candleSeries.setMarkers([]);
+ } else if (!showOriginalKline && tvWidget.series.lineSeries) {
+ tvWidget.series.lineSeries.setMarkers([]);
+ }
}
}
@@ -5084,6 +5212,16 @@
refreshChart(currentData);
});
+ // 绑定KLU分型显示开关
+ $('#showKluFxType').change(function() {
+ refreshChartOnly();
+ });
+
+ // 绑定小周期KLU分型显示开关
+ $('#showElementKluFxType').change(function() {
+ refreshChart(currentData);
+ });
+
// 绑定买卖点显示开关
$('#showTradePoints').change(function() {
refreshChart(currentData);
@@ -5113,7 +5251,9 @@
'showVolume': false,
'showMacd': true,
'showKlcFxType': $('#showKlcFxType').is(':checked'),
+ 'showKluFxType': $('#showKluFxType').is(':checked'),
'showElementKlcFxType': $('#showElementKlcFxType').is(':checked'),
+ 'showElementKluFxType': $('#showElementKluFxType').is(':checked'),
'showTradePoints': $('#showTradePoints').is(':checked'),
'showMainBollinger': $('#showMainBollinger').is(':checked'),
'showElementBollinger': $('#showElementBollinger').is(':checked'),