obv 선 표시
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
mergeIchimokuPlots,
|
||||
resolveIchimokuDisplacements,
|
||||
} from './ichimokuConfig';
|
||||
import { resolvePlotLineColor } from './plotColorUtils';
|
||||
import {
|
||||
normalizePsychologicalParams,
|
||||
resolvePsychologicalIndicatorType,
|
||||
@@ -441,9 +442,21 @@ export function mergePlotDefs(saved: PlotDef[] | undefined, defaults: PlotDef[])
|
||||
});
|
||||
}
|
||||
|
||||
/** OBV·CCI·RSI·TRIX — registry 신호선(plot1) 병합·표시 보장 (DB에 plot0만 저장된 경우 대비) */
|
||||
/** OBV·CCI·RSI·TRIX — 이중 plot 병합·표시 보장 */
|
||||
const SIGNAL_LINE_INDICATOR_TYPES = new Set(['OBV', 'CCI', 'RSI', 'TRIX']);
|
||||
|
||||
function normalizeDualLinePlotDef(saved: PlotDef, reg: PlotDef): PlotDef {
|
||||
return {
|
||||
...reg,
|
||||
...saved,
|
||||
id: reg.id,
|
||||
title: reg.title,
|
||||
type: 'line',
|
||||
lineWidth: Math.max(1, saved.lineWidth ?? reg.lineWidth ?? 1),
|
||||
color: resolvePlotLineColor(saved.color, reg.color),
|
||||
};
|
||||
}
|
||||
|
||||
function normalizeSignalLineIndicatorPlots(
|
||||
type: string,
|
||||
plots: PlotDef[],
|
||||
@@ -455,24 +468,27 @@ function normalizeSignalLineIndicatorPlots(
|
||||
return { plots, plotVisibility };
|
||||
}
|
||||
const merged = mergePlotDefs(plots, registryPlots);
|
||||
|
||||
if (type === 'OBV') {
|
||||
const nextPlots = merged.map(p => {
|
||||
const reg = registryPlots.find(r => r.id === p.id);
|
||||
return reg ? normalizeDualLinePlotDef(p, reg) : p;
|
||||
});
|
||||
return {
|
||||
plots: nextPlots,
|
||||
plotVisibility: { ...plotVisibility, plot0: true, plot1: true },
|
||||
};
|
||||
}
|
||||
|
||||
const regSignal = registryPlots.find(p => p.id === 'plot1');
|
||||
const nextPlots = regSignal
|
||||
? merged.map(p => {
|
||||
if (p.id !== 'plot1') return p;
|
||||
return {
|
||||
...regSignal,
|
||||
...p,
|
||||
id: 'plot1',
|
||||
title: regSignal.title,
|
||||
type: 'line' as const,
|
||||
lineWidth: Math.max(1, p.lineWidth ?? regSignal.lineWidth ?? 1),
|
||||
};
|
||||
return normalizeDualLinePlotDef(p, regSignal);
|
||||
})
|
||||
: merged;
|
||||
const nextVis = { ...plotVisibility };
|
||||
if (type === 'OBV') {
|
||||
nextVis.plot1 = true;
|
||||
} else if ((type === 'CCI' || type === 'RSI') && params.maType === 'None') {
|
||||
if ((type === 'CCI' || type === 'RSI') && params.maType === 'None') {
|
||||
nextVis.plot1 = false;
|
||||
} else if (nextVis.plot1 !== false) {
|
||||
nextVis.plot1 = true;
|
||||
|
||||
Reference in New Issue
Block a user