n봉 존재 조건 수정

This commit is contained in:
Macbook
2026-06-12 23:40:20 +09:00
parent b55349062f
commit 4a6be82c15
8 changed files with 365 additions and 32 deletions
+42 -11
View File
@@ -2,8 +2,14 @@
import React from 'react';
import type { IndicatorConfig } from '../types/index';
import { getIndicatorDef, getHLineLabel, INDICATOR_REGISTRY, type PlotDef, type HLineDef } from '../utils/indicatorRegistry';
import type { LogicNode, LogicNodeType, ConditionDSL } from '../utils/strategyTypes';
import { CONDITION_LABEL, INDICATOR_CONDITIONS } from '../utils/strategyTypes';
import type { LogicNode, LogicNodeType, ConditionDSL, CandleRangeMode } from '../utils/strategyTypes';
import {
CONDITION_LABEL,
INDICATOR_CONDITIONS,
resolveCandleRangeMode,
candleRangeWindowBars,
formatCandleRangeClause,
} from '../utils/strategyTypes';
import {
COMPOSITE_INDICATOR_ITEMS,
compositeDisplayName,
@@ -791,8 +797,9 @@ export const nodeToText = (node: LogicNode, DEF: DefType = DEF_DEFAULTS): string
const op = c.conditionType === 'LOWEST_LTE' ? '≤' : '≥';
return `${indName} - 최근 ${n}${L} 최저 ${op} ${R || '침체선'}`;
}
if (R && R !== '선택안함') return `${indName} - ${L} ${C} ${R}`;
return `${indName} - ${L} ${C}`;
const rangeClause = formatCandleRangeClause(c);
if (R && R !== '선택안함') return `${indName} - ${rangeClause}${L} ${C} ${R}`;
return `${indName} - ${rangeClause}${L} ${C}`;
}
if (node.type === 'AND') {
if (isStableStrategyPairRoot(node) && node.stableStrategyPair?.mode === 'buy') {
@@ -1142,14 +1149,38 @@ export const CondEditor: React.FC<CondEditorProps> = ({
) : (
<>
<label className="sp-cond-lbl"> </label>
<select className="sp-cond-sel" value={cond.candleRange ?? 1}
onChange={e => onChange({ ...cond, candleRange: Number(e.target.value) })}>
<option value={1}> </option>
<option value={2}>2 </option>
<option value={3}>3 </option>
<option value={4}>4 </option>
<option value={5}>5 </option>
<select
className="sp-cond-sel"
value={resolveCandleRangeMode(normalized)}
onChange={e => {
const mode = e.target.value as CandleRangeMode;
if (mode === 'CURRENT') {
onChange({ ...normalized, candleRangeMode: mode, candleRange: 1 });
} else {
const n = candleRangeWindowBars(normalized);
onChange({ ...normalized, candleRangeMode: mode, candleRange: n >= 2 ? n : 4 });
}
}}
>
<option value="CURRENT"> </option>
<option value="EXISTS_IN">N봉 </option>
<option value="NOT_EXISTS_IN">N봉 </option>
</select>
{resolveCandleRangeMode(normalized) !== 'CURRENT' && (
<input
type="number"
className="sp-cond-num sp-cond-num--inline"
min={2}
max={500}
value={candleRangeWindowBars(normalized)}
placeholder="N"
title="윈도우 봉 수"
onChange={e => onChange({
...normalized,
candleRange: Math.max(2, parseInt(e.target.value, 10) || 4),
})}
/>
)}
</>
)}
</div>