N봉 기울기 판단로직 수정

This commit is contained in:
Macbook
2026-06-16 09:12:24 +09:00
parent 518b69cdc6
commit f85c0bef20
10 changed files with 642 additions and 367 deletions
@@ -1,7 +1,7 @@
/**
* 전략 조건 DSL → 알기 쉬운 한국어 서술형 설명
*/
import type { LogicNode } from './strategyTypes';
import type { CandleRangeMode, LogicNode } from './strategyTypes';
import { CONDITION_LABEL } from './strategyTypes';
import {
resolveCandleRangeMode,
@@ -94,10 +94,19 @@ function describeConditionType(
conditionType: string,
left: string,
right: string,
extras: { compareValue?: number; slopePeriod?: number; holdDays?: number; lookbackPeriod?: number },
extras: {
compareValue?: number;
slopePeriod?: number;
holdDays?: number;
lookbackPeriod?: number;
candleRangeMode?: CandleRangeMode;
candleRange?: number;
},
): string {
const cv = extras.compareValue;
const sp = extras.slopePeriod ?? 3;
const sp = (extras.candleRangeMode === 'EXISTS_IN' || extras.candleRangeMode === 'NOT_EXISTS_IN')
? Math.max(2, extras.candleRange ?? 4)
: (extras.slopePeriod ?? 3);
const hd = extras.holdDays ?? 3;
const lb = extras.lookbackPeriod ?? 20;
@@ -156,6 +165,8 @@ function describeCondition(
compareValue: cond.compareValue,
slopePeriod: cond.slopePeriod,
holdDays: cond.holdDays,
candleRangeMode: cond.candleRangeMode,
candleRange: cond.candleRange,
});
return base + tfNote;
}
@@ -172,6 +183,11 @@ function describeCondition(
return prefix + describeConditionType(ct, left, right, cond);
}
if (['SLOPE_UP', 'SLOPE_DOWN'].includes(ct)) {
const prefix = formatCandleRangeClause(cond);
return prefix + describeConditionType(ct, left, right, cond);
}
const label = CONDITION_LABEL[ct] ?? ct;
return `${left}에 대해 「${label}」 조건이 성립하는 경우`;
}