보조지표 관련 수정
This commit is contained in:
@@ -32,7 +32,7 @@ function overlayWorkspaceVisualOntoStrategyIndicator(
|
||||
id: ind.id,
|
||||
hidden: ind.hidden,
|
||||
mergedWith: ind.mergedWith,
|
||||
plotVisibility: { plot0: true, plot1: true, ...ws.plotVisibility },
|
||||
plotVisibility: ws.plotVisibility ?? ind.plotVisibility,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -586,8 +586,9 @@ function normalizeSignalLineIndicatorPlots(
|
||||
return order.indexOf(a.id) - order.indexOf(b.id);
|
||||
});
|
||||
const nextVis = { ...plotVisibility };
|
||||
nextVis.plot0 = true;
|
||||
nextVis.plot1 = true;
|
||||
for (const p of nextPlots) {
|
||||
if (nextVis[p.id] === undefined) nextVis[p.id] = true;
|
||||
}
|
||||
return { plots: nextPlots, plotVisibility: nextVis };
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ import {
|
||||
import { initializeIndicatorConfigForEditor } from './indicatorSettingsEditor';
|
||||
import { mergeGlobalDefaultsOntoChartIndicators } from './indicatorMainConfig';
|
||||
import { buildChartIndicatorConfig } from './indicatorPaneMerge';
|
||||
import { normalizeSmaConfig } from './smaConfig';
|
||||
import { normalizeIchimokuConfig } from './ichimokuConfig';
|
||||
import type { EditorConditionState } from './strategyConditionSerde';
|
||||
import { collectUiEvaluationTimeframes } from './strategyTimeframeSync';
|
||||
|
||||
@@ -339,3 +341,57 @@ export function buildVirtualTradingCardChartIndicators(
|
||||
): IndicatorConfig[] {
|
||||
return buildStrategyChartIndicators(strategy, getParams, getVisual).slice(0, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* DB 보조지표 설정(플롯 on/off·색·선유형·굵기·수평선)을 strat_* 지표에 반영.
|
||||
* 워크스페이스 ind_* 인스턴스 plots/hidden 은 사용하지 않는다.
|
||||
*/
|
||||
export function applyDbVisualSettingsForStrategyChart(
|
||||
config: IndicatorConfig,
|
||||
getVisual: GetVisual,
|
||||
): IndicatorConfig {
|
||||
const def = getIndicatorDef(config.type);
|
||||
if (!def) return enrichIndicatorConfig(config);
|
||||
|
||||
let cfg = initializeIndicatorConfigForEditor(
|
||||
{
|
||||
...config,
|
||||
plots: [],
|
||||
hlines: [],
|
||||
cloudColors: undefined,
|
||||
bandBackground: undefined,
|
||||
plotVisibility: undefined,
|
||||
},
|
||||
undefined,
|
||||
(type, defaultPlots, defaultHlines) => getVisual(type, defaultPlots ?? [], defaultHlines ?? []),
|
||||
);
|
||||
|
||||
if (cfg.type === 'SMA') cfg = normalizeSmaConfig(cfg);
|
||||
else if (cfg.type === 'IchimokuCloud') cfg = normalizeIchimokuConfig(cfg);
|
||||
return enrichIndicatorConfig(cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 전략 평가 차트 — 전략 DSL 지표 + 기본 오버레이.
|
||||
* 보조지표 설정 DB의 플롯 on/off·스타일을 따르고,
|
||||
* 워크스페이스 차트 on/off(hidden)와 무관하게 전략에 쓰인 지표 pane 은 항상 표시한다.
|
||||
*/
|
||||
export function buildStrategyEvaluationChartIndicators(
|
||||
strategy: StrategyDto | undefined,
|
||||
getParams: GetParams,
|
||||
getVisual: GetVisual,
|
||||
): IndicatorConfig[] {
|
||||
if (!strategy) return [];
|
||||
|
||||
const strategyTypes = new Set(collectStrategyRegistryTypes(strategy));
|
||||
let inds = buildVirtualTradingChartIndicators(strategy, getParams, getVisual);
|
||||
inds = ensurePaperChartOverlays(inds, getParams, getVisual);
|
||||
|
||||
return inds.map(ind => {
|
||||
let cfg = applyDbVisualSettingsForStrategyChart(ind, getVisual);
|
||||
if (strategyTypes.has(cfg.type)) {
|
||||
cfg = { ...cfg, hidden: false };
|
||||
}
|
||||
return cfg;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user