Web 加上资金面/情绪叠图,并收紧默认图面。
默认主/次/次次改为 45m/15m/5m、开始时间一周;SD/CD 按 hist 摆位置和箭头;去掉笔线段背驰与第四类勾选。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -43,6 +43,67 @@ function clearChanMacdMarkers() {
|
||||
}
|
||||
// 清空全局UnitTF标记,避免旧数据残留影响主图合并
|
||||
window.unittfMarkers = [];
|
||||
window.unittfMarkersMain = [];
|
||||
window.unittfMarkersElement = [];
|
||||
window.unittfMarkersSubSub = [];
|
||||
}
|
||||
|
||||
function unittfDirSign(dir) {
|
||||
if (dir === 'ABOVE' || dir === 1 || dir === '1' || dir === true) return 1;
|
||||
if (dir === 'UNDER' || dir === -1 || dir === '-1') return -1;
|
||||
const n = Number(dir);
|
||||
if (n > 0) return 1;
|
||||
if (n < 0) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
function buildUnittfOverlayMarkers(unittfList, opt) {
|
||||
const markers = [];
|
||||
if (!Array.isArray(unittfList) || !opt) return markers;
|
||||
const up = opt.up, down = opt.down, prefix = opt.prefix || 'U';
|
||||
const size = opt.size || 0.5;
|
||||
for (let i = 0; i < unittfList.length; i++) {
|
||||
const unittf = unittfList[i];
|
||||
if (!unittf || !unittf.start_time || unittf.invalid) continue;
|
||||
const startTime = Math.floor(new Date(unittf.start_time).getTime() / 1000);
|
||||
if (isNaN(startTime)) continue;
|
||||
const sign = unittfDirSign(unittf.dir);
|
||||
const color = sign > 0 ? up : down;
|
||||
const pos = sign > 0 ? 'aboveBar' : 'belowBar';
|
||||
markers.push({ time: startTime, position: pos, color: color, shape: 'circle', text: prefix + i, size: size });
|
||||
if (unittf.end_time) {
|
||||
const endTime = Math.floor(new Date(unittf.end_time).getTime() / 1000);
|
||||
if (!isNaN(endTime)) {
|
||||
markers.push({ time: endTime, position: pos, color: color, shape: 'circle', text: prefix + i + 'E', size: size });
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let i = 0; i + 1 < unittfList.length; i++) {
|
||||
const cur = unittfList[i];
|
||||
const nxt = unittfList[i + 1];
|
||||
if (!cur || !nxt || !cur.end_time || !nxt.start_time) continue;
|
||||
const tEnd = new Date(cur.end_time).getTime();
|
||||
const tStart = new Date(nxt.start_time).getTime();
|
||||
if (!isNaN(tEnd) && tEnd === tStart) {
|
||||
const sign = unittfDirSign(nxt.dir);
|
||||
markers.push({
|
||||
time: Math.floor(tEnd / 1000),
|
||||
position: sign > 0 ? 'aboveBar' : 'belowBar',
|
||||
color: sign > 0 ? (opt.boundaryUp || up) : (opt.boundaryDown || down),
|
||||
shape: 'square',
|
||||
text: prefix + '↔',
|
||||
size: 0.6
|
||||
});
|
||||
}
|
||||
}
|
||||
return markers;
|
||||
}
|
||||
|
||||
function refreshUnittfOverlayFromData(data) {
|
||||
// U/穿零轴只画在 MACD 副图,不再铺到主图
|
||||
window.unittfMarkersMain = [];
|
||||
window.unittfMarkersElement = [];
|
||||
window.unittfMarkersSubSub = [];
|
||||
}
|
||||
// 添加所有ChanMACD标记
|
||||
function addAllChanMacdMarkers(segList, unittfList, histsetList, stateMarkers) {
|
||||
@@ -215,8 +276,7 @@ function addAllChanMacdMarkers(segList, unittfList, histsetList, stateMarkers) {
|
||||
|
||||
// 保存到全局,供主图与分型一起统一合并绘制(仅在开关开启时)
|
||||
console.log('DEBUG: U 标记数量:', signalMarkers.length);
|
||||
const allowUMerge = (window.showUOnMain && window.showUOnElement);
|
||||
window.unittfMarkers = allowUMerge ? [...signalMarkers, ...boundaryMarkers] : [];
|
||||
window.unittfMarkers = [...signalMarkers, ...boundaryMarkers];
|
||||
if (uTooltipMarkers.length > 0) {
|
||||
if (window.fxMarkers) {
|
||||
window.fxMarkers = [ ...window.fxMarkers, ...uTooltipMarkers ];
|
||||
|
||||
Reference in New Issue
Block a user