n봉 존재 조건 수정
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user