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
+30 -1
View File
@@ -150,6 +150,25 @@ export function resolveFieldCustomKind(
return 'none';
}
const INDICATORS_WITH_RIGHT_THRESHOLD_INPUT = new Set([
'RSI', 'STOCHASTIC', 'CCI', 'ADX', 'DMI', 'WILLIAMS_R', 'TRIX',
'PSYCHOLOGICAL', 'NEW_PSYCHOLOGICAL', 'INVEST_PSYCHOLOGICAL', 'BWI', 'VR',
'VOLUME_OSC', 'DISPARITY',
]);
/** 조건대상2 — 임계값 직접입력 노출 여부 */
export function resolveRightFieldCustomKind(
indicatorType: string,
field: string | undefined,
): 'period' | 'threshold' | 'none' {
const base = resolveFieldCustomKind(indicatorType, field);
if (base !== 'none') return base;
if (parseThresholdField(field) != null) return 'threshold';
if (isThresholdFieldOrSymbol(field)) return 'threshold';
if (INDICATORS_WITH_RIGHT_THRESHOLD_INPUT.has(indicatorType)) return 'threshold';
return 'none';
}
export function isValuePeriodFieldStored(indicatorType: string, field?: string): boolean {
const prefix = VALUE_FIELD_PREFIX[indicatorType];
if (!prefix || !field) return false;
@@ -244,7 +263,17 @@ export function setConditionThreshold(
): ConditionDSL {
const fieldKey = side === 'left' ? 'leftField' : 'rightField';
const current = cond[fieldKey];
if (!isThresholdFieldOrSymbol(current)) return cond;
if (!isThresholdFieldOrSymbol(current)) {
if (side === 'right' && INDICATORS_WITH_RIGHT_THRESHOLD_INPUT.has(cond.indicatorType)) {
return {
...cond,
[fieldKey]: thresholdField(value),
targetValue: value,
thresholdOverride: true,
};
}
return cond;
}
const inheritedField = side === 'right'
? (current?.startsWith('K_') || isThresholdSymbol(current) ? current : THRESHOLD_HL_OVER)