보조지표 관련 수정
This commit is contained in:
@@ -39,10 +39,7 @@ import {
|
|||||||
type ChartOverlayToggleKey,
|
type ChartOverlayToggleKey,
|
||||||
type ChartOverlayVisibility,
|
type ChartOverlayVisibility,
|
||||||
} from '../../utils/chartOverlayVisibility';
|
} from '../../utils/chartOverlayVisibility';
|
||||||
import {
|
import { buildStrategyEvaluationChartIndicators } from '../../utils/strategyToChartIndicators';
|
||||||
buildVirtualTradingChartIndicators,
|
|
||||||
ensurePaperChartOverlays,
|
|
||||||
} from '../../utils/strategyToChartIndicators';
|
|
||||||
import { buildEvalParamsFromStrategy } from '../../utils/strategyEvaluationParams';
|
import { buildEvalParamsFromStrategy } from '../../utils/strategyEvaluationParams';
|
||||||
import { indicatorDefaultsFingerprint } from '../../utils/indicatorDefaultsFingerprint';
|
import { indicatorDefaultsFingerprint } from '../../utils/indicatorDefaultsFingerprint';
|
||||||
import { repairUtf8Mojibake } from '../../utils/textEncoding';
|
import { repairUtf8Mojibake } from '../../utils/textEncoding';
|
||||||
@@ -173,9 +170,7 @@ const StrategyEvaluationChart: React.FC<Props> = ({
|
|||||||
|
|
||||||
const baseIndicators = useMemo(() => {
|
const baseIndicators = useMemo(() => {
|
||||||
if (!strategy) return [] as IndicatorConfig[];
|
if (!strategy) return [] as IndicatorConfig[];
|
||||||
let inds = buildVirtualTradingChartIndicators(strategy, getParams, getVisualConfig);
|
return buildStrategyEvaluationChartIndicators(strategy, getParams, getVisualConfig);
|
||||||
inds = ensurePaperChartOverlays(inds, getParams, getVisualConfig);
|
|
||||||
return inds;
|
|
||||||
}, [strategy, getParams, getVisualConfig, settingsRevision]);
|
}, [strategy, getParams, getVisualConfig, settingsRevision]);
|
||||||
|
|
||||||
const indicators = useMemo(
|
const indicators = useMemo(
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ function overlayWorkspaceVisualOntoStrategyIndicator(
|
|||||||
id: ind.id,
|
id: ind.id,
|
||||||
hidden: ind.hidden,
|
hidden: ind.hidden,
|
||||||
mergedWith: ind.mergedWith,
|
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);
|
return order.indexOf(a.id) - order.indexOf(b.id);
|
||||||
});
|
});
|
||||||
const nextVis = { ...plotVisibility };
|
const nextVis = { ...plotVisibility };
|
||||||
nextVis.plot0 = true;
|
for (const p of nextPlots) {
|
||||||
nextVis.plot1 = true;
|
if (nextVis[p.id] === undefined) nextVis[p.id] = true;
|
||||||
|
}
|
||||||
return { plots: nextPlots, plotVisibility: nextVis };
|
return { plots: nextPlots, plotVisibility: nextVis };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ import {
|
|||||||
import { initializeIndicatorConfigForEditor } from './indicatorSettingsEditor';
|
import { initializeIndicatorConfigForEditor } from './indicatorSettingsEditor';
|
||||||
import { mergeGlobalDefaultsOntoChartIndicators } from './indicatorMainConfig';
|
import { mergeGlobalDefaultsOntoChartIndicators } from './indicatorMainConfig';
|
||||||
import { buildChartIndicatorConfig } from './indicatorPaneMerge';
|
import { buildChartIndicatorConfig } from './indicatorPaneMerge';
|
||||||
|
import { normalizeSmaConfig } from './smaConfig';
|
||||||
|
import { normalizeIchimokuConfig } from './ichimokuConfig';
|
||||||
import type { EditorConditionState } from './strategyConditionSerde';
|
import type { EditorConditionState } from './strategyConditionSerde';
|
||||||
import { collectUiEvaluationTimeframes } from './strategyTimeframeSync';
|
import { collectUiEvaluationTimeframes } from './strategyTimeframeSync';
|
||||||
|
|
||||||
@@ -339,3 +341,57 @@ export function buildVirtualTradingCardChartIndicators(
|
|||||||
): IndicatorConfig[] {
|
): IndicatorConfig[] {
|
||||||
return buildStrategyChartIndicators(strategy, getParams, getVisual).slice(0, 1);
|
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