MACD使用标准参数

This commit is contained in:
jackyu66git
2025-08-10 19:55:26 +08:00
parent 05942fed8e
commit 285f62f1ab
15 changed files with 1281 additions and 39 deletions
+13 -20
View File
@@ -1255,7 +1255,6 @@
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script>
let currentData = null;
@@ -1808,7 +1807,6 @@
}
});
}
// 初始化图表
function initTradingView(symbol, timeframe) {
try {
@@ -1955,28 +1953,32 @@
// 如果需要显示MACD,创建MACD容器
let macdChartContainer = null;
if (showMacd) {
// 设置各图表高度 - 为四个图表分配合理比例
// 显示MACD时:主图(45%) → MACD(17.5%) → 成交量(20%) → ATR(17.5%)
mainChartContainer.style.height = '45%'; // 主图占45%
volumeChartContainer.style.top = '45%';
volumeChartContainer.style.height = '20%'; // 成交量图占20%
atrChartContainer.style.top = '65%'; // ATR图从65%位置开始
atrChartContainer.style.height = '17.5%'; // ATR图占17.5%
// MACD 放到成交量上方
macdChartContainer = document.createElement('div');
macdChartContainer.style.width = '100%';
macdChartContainer.style.height = '17.5%'; // MACD图占17.5%
macdChartContainer.style.position = 'absolute';
macdChartContainer.style.top = '82.5%'; // 从82.5%位置开始
macdChartContainer.style.top = '45%'; // 紧贴主图下方
macdChartContainer.style.left = '0';
macdChartContainer.style.right = '0';
macdChartContainer.style.borderTop = '1px solid #e0e0e0';
// 成交量位于 MACD 之下
volumeChartContainer.style.top = '62.5%';
volumeChartContainer.style.height = '20%'; // 成交量图占20%
// ATR 位于最底部
atrChartContainer.style.top = '82.5%'; // ATR图从82.5%位置开始
atrChartContainer.style.height = '17.5%'; // ATR图占17.5%
} else {
// 不显示MACD时的高度 - 主图、成交量图和ATR图分配
mainChartContainer.style.height = '55%'; // 主图占55%
volumeChartContainer.style.top = '55%';
volumeChartContainer.style.height = '22.5%'; // 成交量图占22.5%
atrChartContainer.style.top = '77.5%'; // ATR图从77.5%位置开始
atrChartContainer.style.height = '22.5%'; // ATR图占22.5%
}
@@ -2567,7 +2569,6 @@
}
}, 200);
});
// 显示笔的绘制 - 分别处理主周期和次周期
if ($('#showMainBi').is(':checked') || $('#showElementBi').is(':checked')) {
console.log('绘制笔 - 已启用');
@@ -3152,7 +3153,6 @@
} else {
console.log('绘制线段 - 已禁用');
}
// 显示中枢的绘制 - 分别处理主周期和次周期
if ($('#showMainZs').is(':checked') || $('#showElementZs').is(':checked')) {
console.log('绘制中枢 - 已启用');
@@ -3728,7 +3728,6 @@
} else {
console.log('绘制未完成中枢 - 已禁用');
}
// 添加买卖点标记
if ($('#showTradePoints').is(':checked')) {
console.log('绘制买卖点 - 已启用');
@@ -4433,7 +4432,6 @@
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)) {
@@ -5169,7 +5167,6 @@
}, 200);
});
}
function setupTooltip(mainChart, buyMarkers = [], sellMarkers = [], mainChartContainer, volumeChartContainer, atrChartContainer, macdChartContainer, volumeChart, atrChart, macdChart, showMacd) {
// 调试变量
window.debugMode = true;
@@ -5961,7 +5958,6 @@
return `${year}-${month}-${day}T${hours}:${minutes}`;
}
// 页面加载时初始化
$(document).ready(function() {
// 从本地存储中恢复时区设置
@@ -6723,7 +6719,6 @@
}
});
}
// 初始化回放
function initReplay() {
// 检查是否有新的回放数据结构
@@ -7511,7 +7506,6 @@
alertDiv.alert('close');
}, 10000);
}
// 显示成功提示
function showSuccessAlert(message) {
const alertDiv = $(`
@@ -8259,7 +8253,6 @@
console.log('🔄 按钮已重置为添加模式,等待用户主动点击"添加布林带"按钮');
}
// 添加布林带
function addBollingerBand() {
console.log('🚨🚨🚨 警告:addBollingerBand函数被调用了!!!');