修改笔中枢bug

This commit is contained in:
jackyu66git
2025-10-25 00:08:46 +08:00
parent 021cd3a1e3
commit abe663e1a6
2 changed files with 12 additions and 18 deletions
+2 -2
View File
@@ -96,7 +96,7 @@ class ChanSEG():
for index in range(1, len(self.bi_list)): for index in range(1, len(self.bi_list)):
bi = self.bi_list[index] bi = self.bi_list[index]
if len(zs_list) == 0 or (last_zs and last_zs.is_sure): if len(zs_list) == 0 or (last_zs and last_zs.is_sure):
if bi.next and bi.next.next and bi.next.next.is_sure and bi.check_bi_zs_overlap() and bi.dir == Chan_BI_DIR.DOWN: if bi.next and bi.next.next and bi.next.next.is_sure and bi.next.next.index <= self.bi_list[-1].index and bi.check_bi_zs_overlap() and bi.dir == Chan_BI_DIR.DOWN:
zg = min(bi.high, bi.next.high, bi.next.next.high) zg = min(bi.high, bi.next.high, bi.next.next.high)
zd = max(bi.low, bi.next.low, bi.next.next.low) zd = max(bi.low, bi.next.low, bi.next.next.low)
gg = max(bi.high, bi.next.high, bi.next.next.high) gg = max(bi.high, bi.next.high, bi.next.next.high)
@@ -135,7 +135,7 @@ class ChanSEG():
for index in range(1, len(self.bi_list)): for index in range(1, len(self.bi_list)):
bi = self.bi_list[index] bi = self.bi_list[index]
if len(zs_list) == 0 or (last_zs and last_zs.is_sure): if len(zs_list) == 0 or (last_zs and last_zs.is_sure):
if bi.next and bi.next.next and bi.next.next.is_sure and bi.check_bi_zs_overlap() and bi.dir == Chan_BI_DIR.UP: if bi.next and bi.next.next and bi.next.next.is_sure and bi.next.next.index <= self.bi_list[-1].index and bi.check_bi_zs_overlap() and bi.dir == Chan_BI_DIR.UP:
zg = min(bi.high, bi.next.high, bi.next.next.high) zg = min(bi.high, bi.next.high, bi.next.next.high)
zd = max(bi.low, bi.next.low, bi.next.next.low) zd = max(bi.low, bi.next.low, bi.next.next.low)
gg = max(bi.high, bi.next.high, bi.next.next.high) gg = max(bi.high, bi.next.high, bi.next.next.high)
+10 -16
View File
@@ -2726,6 +2726,14 @@
hasKlineData: !!currentData.kline_data, hasKlineData: !!currentData.kline_data,
isArray: Array.isArray(currentData.kline_data) isArray: Array.isArray(currentData.kline_data)
}); });
// 在创建 ChanMACD 前,确保一次性同步 U 显示开关到全局(默认不显示)
if (typeof window.showUOnMain === 'undefined') {
window.showUOnMain = $('#toggleUOnMain').is(':checked');
}
if (typeof window.showUOnElement === 'undefined') {
window.showUOnElement = $('#toggleUOnElement').is(':checked');
}
if (showMacd && chanMacdChart && ((useElementPeriod && currentData.element_macd) || currentData.macd) && (useElementPeriod ? currentData.element_kline_data : currentData.kline_data)) { if (showMacd && chanMacdChart && ((useElementPeriod && currentData.element_macd) || currentData.macd) && (useElementPeriod ? currentData.element_kline_data : currentData.kline_data)) {
console.log('✅ 开始创建 ChanMACD 系列'); console.log('✅ 开始创建 ChanMACD 系列');
// 创建ChanMACD线系列 // 创建ChanMACD线系列
@@ -2990,7 +2998,7 @@
(currentData.element_macd || currentData.macd), (currentData.element_macd || currentData.macd),
(currentData.element_kline_data || currentData.kline_data) (currentData.element_kline_data || currentData.kline_data)
); );
if ((typeof window.showUOnMain === 'undefined' ? true : window.showUOnMain) && Array.isArray(mainCmAll.klu_list)) { if ((typeof window.showUOnMain === 'undefined' ? false : window.showUOnMain) && Array.isArray(mainCmAll.klu_list)) {
mainCmAll.klu_list.forEach((item) => { mainCmAll.klu_list.forEach((item) => {
if (!item || !item.time) return; if (!item || !item.time) return;
const ts = Math.floor(new Date(item.time).getTime() / 1000); const ts = Math.floor(new Date(item.time).getTime() / 1000);
@@ -3010,7 +3018,7 @@
} }
}); });
} }
if ((typeof window.showUOnElement === 'undefined' ? true : window.showUOnElement) && Array.isArray(elementCmAll.klu_list)) { if ((typeof window.showUOnElement === 'undefined' ? false : window.showUOnElement) && Array.isArray(elementCmAll.klu_list)) {
elementCmAll.klu_list.forEach((item) => { elementCmAll.klu_list.forEach((item) => {
if (!item || !item.time) return; if (!item || !item.time) return;
const ts = Math.floor(new Date(item.time).getTime() / 1000); const ts = Math.floor(new Date(item.time).getTime() / 1000);
@@ -7662,20 +7670,6 @@
refreshChart(currentData); refreshChart(currentData);
}); });
// 绑定KLU分型显示开关
$('#showKluFxType').change(function() {
refreshChartOnly();
});
// 绑定小周期KLU分型显示开关
$('#showElementKluFxType').change(function() {
refreshChart(currentData);
});
// 绑定买卖点显示开关
$('#showTradePoints').change(function() {
refreshChart(currentData);
});
// 绑定布林带显示变更事件 // 绑定布林带显示变更事件
$('#showMainBollinger').change(function() { $('#showMainBollinger').change(function() {