添加识别笔破坏
This commit is contained in:
+12
-12
@@ -1243,7 +1243,7 @@
|
||||
r.close,
|
||||
r.ema5,
|
||||
r.ema10,
|
||||
r.ema24,
|
||||
r.ema26,
|
||||
r.ema52,
|
||||
`<button class="btn btn-sm btn-outline-primary" data-symbol="${r.symbol}" data-timeframe="${timeframe}">查看</button>`
|
||||
]);
|
||||
@@ -1284,7 +1284,7 @@
|
||||
trendDetailTable.row.add([
|
||||
new Date(row.timestamp).toLocaleString('zh-CN', { timeZone: data.timezone }),
|
||||
row.open, row.high, row.low, row.close, row.volume,
|
||||
row.ema5, row.ema10, row.ema24, row.ema52
|
||||
row.ema5, row.ema10, row.ema26, row.ema52
|
||||
]);
|
||||
});
|
||||
trendDetailTable.draw();
|
||||
@@ -1317,7 +1317,7 @@
|
||||
// 关闭均线的价格线与最后值标签,仅保留K线的当前价格虚线
|
||||
const ema5 = chart.addLineSeries({ color: '#ff0000', lineWidth: 2, lastValueVisible: false, priceLineVisible: false });
|
||||
const ema10 = chart.addLineSeries({ color: '#2962FF', lineWidth: 2, lastValueVisible: false, priceLineVisible: false });
|
||||
const ema24 = chart.addLineSeries({ color: '#008000', lineWidth: 2, lastValueVisible: false, priceLineVisible: false });
|
||||
const ema26 = chart.addLineSeries({ color: '#008000', lineWidth: 2, lastValueVisible: false, priceLineVisible: false });
|
||||
const ema52 = chart.addLineSeries({ color: '#800080', lineWidth: 2, lastValueVisible: false, priceLineVisible: false });
|
||||
|
||||
const k = (data.kline_data || []).map(r => ({
|
||||
@@ -1347,7 +1347,7 @@
|
||||
};
|
||||
ema5.setData(sanitizeMA('ema5'));
|
||||
ema10.setData(sanitizeMA('ema10'));
|
||||
ema24.setData(sanitizeMA('ema24'));
|
||||
ema26.setData(sanitizeMA('ema26'));
|
||||
ema52.setData(sanitizeMA('ema52'));
|
||||
|
||||
// 趋势线(使用返回的拟合参数)
|
||||
@@ -1400,12 +1400,12 @@
|
||||
|
||||
function classifyStageFrontend(kline, directionHint) {
|
||||
const close = kline.map(r => Number(r.close));
|
||||
const ema24 = computeEMA(close, 24);
|
||||
const ema26 = computeEMA(close, 26);
|
||||
const ema52 = computeEMA(close, 52);
|
||||
const last = close[close.length-1];
|
||||
const e24 = ema24[ema24.length-1];
|
||||
const e26 = ema26[ema26.length-1];
|
||||
const e52 = ema52[ema52.length-1];
|
||||
const s24 = slope(ema24, 20);
|
||||
const s26 = slope(ema26, 20);
|
||||
const s52 = slope(ema52, 30);
|
||||
const dist52 = (e52 && isFinite(e52)) ? (last - e52)/e52 : 0;
|
||||
const { hist } = computeMACDSeries(close);
|
||||
@@ -1417,8 +1417,8 @@
|
||||
|
||||
let direction = directionHint;
|
||||
if (!direction) {
|
||||
if (e24 > e52 && s24 > 0 && s52 > 0) direction = 'bull';
|
||||
else if (e24 < e52 && s24 < 0 && s52 < 0) direction = 'bear';
|
||||
if (e26 > e52 && s26 > 0 && s52 > 0) direction = 'bull';
|
||||
else if (e26 < e52 && s26 < 0 && s52 < 0) direction = 'bear';
|
||||
else direction = 'sideways';
|
||||
}
|
||||
|
||||
@@ -1426,11 +1426,11 @@
|
||||
const ad = Math.abs(dist52);
|
||||
if (direction === 'bull') {
|
||||
if (ad < 0.03 && growth > 0) stage = 'early';
|
||||
else if (ad < 0.10 && (growth >= 0 || s24 > 0)) stage = 'mid';
|
||||
else if (ad < 0.10 && (growth >= 0 || s26 > 0)) stage = 'mid';
|
||||
else stage = 'late';
|
||||
} else if (direction === 'bear') {
|
||||
if (ad < 0.03 && growth > 0) stage = 'early';
|
||||
else if (ad < 0.10 && (growth >= 0 || s24 < 0)) stage = 'mid';
|
||||
else if (ad < 0.10 && (growth >= 0 || s26 < 0)) stage = 'mid';
|
||||
else stage = 'late';
|
||||
} else {
|
||||
stage = 'early';
|
||||
@@ -6035,7 +6035,7 @@
|
||||
|
||||
const defaultMAs = [
|
||||
{ type: 'EMA', length: 52, color: '#800080', name: 'EMA52' }, // 紫色
|
||||
{ type: 'EMA', length: 24, color: '#008000', name: 'EMA24' }, // 深绿色
|
||||
{ type: 'EMA', length: 26, color: '#008000', name: 'EMA26' }, // 深绿色
|
||||
{ type: 'EMA', length: 104, color: '#FF8C00', name: 'EMA104' }, // 橙色
|
||||
{ type: 'EMA', length: 156, color: '#1E90FF', name: 'EMA156' }, // 蓝色
|
||||
{ type: 'EMA', length: 208, color: '#1F004F', name: 'EMA312' } // 蓝色
|
||||
|
||||
Reference in New Issue
Block a user