알림목록 obv 그래프 문제 최종수정
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import type { IndicatorConfig } from '../types';
|
||||
import type { PlotDef, HLineDef } from './indicatorRegistry';
|
||||
import { getIndicatorDef, enrichIndicatorConfig } from './indicatorRegistry';
|
||||
import { getIndicatorDef, enrichIndicatorConfig, mergePlotDefs } from './indicatorRegistry';
|
||||
import { MAIN_INDICATOR_TYPES } from './indicatorMainTab';
|
||||
import { getSettingsIndicatorTypes } from './indicatorSettingsList';
|
||||
import { initializeIndicatorConfigForEditor } from './indicatorSettingsEditor';
|
||||
@@ -15,6 +15,38 @@ import { normalizeIchimokuConfig } from './ichimokuConfig';
|
||||
import type { IchimokuCloudColors } from './ichimokuConfig';
|
||||
import { isMainIndicatorType } from './indicatorMainTab';
|
||||
import { indicatorDefaultsFingerprint } from './indicatorDefaultsFingerprint';
|
||||
import { isStrategyChartIndicatorId } from './strategyToChartIndicators';
|
||||
|
||||
function overlayWorkspaceVisualOntoStrategyIndicator(
|
||||
ind: IndicatorConfig,
|
||||
workspaceByType: Map<string, IndicatorConfig>,
|
||||
): IndicatorConfig {
|
||||
if (!isStrategyChartIndicatorId(ind.id)) return ind;
|
||||
const ws = workspaceByType.get(ind.type);
|
||||
if (!ws) return ind;
|
||||
|
||||
/** OBV — slot0 워크스페이스 인스턴스와 동일 params·plots (maLength·실선 신호선 등) */
|
||||
if (ind.type === 'OBV') {
|
||||
return enrichIndicatorConfig({
|
||||
...ws,
|
||||
id: ind.id,
|
||||
hidden: ind.hidden,
|
||||
mergedWith: ind.mergedWith,
|
||||
plotVisibility: { plot0: true, plot1: true, ...ws.plotVisibility },
|
||||
});
|
||||
}
|
||||
|
||||
const def = getIndicatorDef(ind.type);
|
||||
return {
|
||||
...ind,
|
||||
plots: ws.plots?.length
|
||||
? mergePlotDefs(ws.plots, ind.plots ?? def?.plots ?? [])
|
||||
: ind.plots,
|
||||
hlines: ws.hlines?.length ? ws.hlines : ind.hlines,
|
||||
cloudColors: ws.cloudColors ?? ind.cloudColors,
|
||||
bandBackground: ws.bandBackground ?? ind.bandBackground,
|
||||
};
|
||||
}
|
||||
|
||||
export type MainIndicatorDraftMap = Record<string, IndicatorConfig>;
|
||||
|
||||
@@ -103,11 +135,29 @@ export function mergeGlobalDefaultsOntoChartIndicators(
|
||||
defaultPlots?: PlotDef[],
|
||||
defaultHlines?: HLineDef[],
|
||||
) => { plots: PlotDef[]; hlines: HLineDef[]; cloudColors?: IchimokuCloudColors },
|
||||
workspaceIndicators?: IndicatorConfig[],
|
||||
): IndicatorConfig[] {
|
||||
const workspaceByType = workspaceIndicators?.length
|
||||
? new Map(workspaceIndicators.map(i => [i.type, i]))
|
||||
: null;
|
||||
|
||||
return activeIndicators.map(ind => {
|
||||
const cfg = buildMainIndicatorConfig(ind.type, [ind], getParams, getVisualConfig);
|
||||
/**
|
||||
* strat_* 지표(알림 미니 차트 등) — raw.plots 가 registry 기본값(점선·주황)으로
|
||||
* 고정되면 getVisualConfig(DB 전역 설정)를 덮어씀. 워크스페이스 ind_* 만 인스턴스 plots 유지.
|
||||
*/
|
||||
const baseInd = isStrategyChartIndicatorId(ind.id)
|
||||
? {
|
||||
...ind,
|
||||
plots: [],
|
||||
hlines: [],
|
||||
cloudColors: undefined,
|
||||
bandBackground: undefined,
|
||||
}
|
||||
: ind;
|
||||
const cfg = buildMainIndicatorConfig(ind.type, [baseInd], getParams, getVisualConfig);
|
||||
if (!cfg) return enrichIndicatorConfig(ind);
|
||||
return finalizeMainIndicatorConfig(
|
||||
let out = finalizeMainIndicatorConfig(
|
||||
{
|
||||
...cfg,
|
||||
id: ind.id,
|
||||
@@ -116,6 +166,11 @@ export function mergeGlobalDefaultsOntoChartIndicators(
|
||||
},
|
||||
false,
|
||||
);
|
||||
if (workspaceByType) {
|
||||
out = overlayWorkspaceVisualOntoStrategyIndicator(out, workspaceByType);
|
||||
out = finalizeMainIndicatorConfig(out, false);
|
||||
}
|
||||
return out;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user