백테스팅 시간봉 문제

This commit is contained in:
Macbook
2026-06-12 00:07:48 +09:00
parent d5338274d4
commit 578cba3eb8
3 changed files with 44 additions and 28 deletions
@@ -7,6 +7,7 @@ import type { StrategyDto } from './backendApi';
import { formatIndicatorDisplayLabel } from './indicatorRegistry';
import { coerceFiniteNumber, safeToFixed } from './safeFormat';
import { asLogicNode } from './strategyHydrate';
import { normalizeStartCandleType } from './strategyStartNodes';
export { coerceFiniteNumber } from './safeFormat';
@@ -37,7 +38,9 @@ function walk(
if (!node) return;
if (node.type === 'TIMEFRAME') {
const tf = node.candleType ?? timeframe;
const tf = normalizeStartCandleType(
node.candleTypes?.[0] ?? node.candleType ?? timeframe,
);
node.children?.forEach(c => walk(c, tf, side, out, seen));
return;
}
@@ -51,7 +54,8 @@ function walk(
// StrategyDslToTa4jAdapter 와 동일: type 미설정(구버전 DSL) 시 CONDITION 으로 처리
if ((!node.type || node.type === 'CONDITION') && node.condition) {
const c = node.condition;
const key = `${side}:${timeframe}:${c.indicatorType}:${c.conditionType}:${c.targetValue ?? ''}:${c.leftField ?? ''}`;
const rowTf = normalizeStartCandleType(c.leftCandleType ?? c.rightCandleType ?? timeframe);
const key = `${side}:${rowTf}:${c.indicatorType}:${c.conditionType}:${c.targetValue ?? ''}:${c.leftField ?? ''}`;
if (seen.has(key)) return;
seen.add(key);
@@ -66,7 +70,7 @@ function walk(
conditionType: c.conditionType,
conditionLabel: condLabel,
targetValue: target,
timeframe,
timeframe: rowTf,
side,
plotKey,
});