전략빌더 수정

This commit is contained in:
Macbook
2026-05-24 13:15:26 +09:00
parent 5685deb2c7
commit b95b232e5b
9 changed files with 516 additions and 16 deletions
+76
View File
@@ -40,6 +40,26 @@ function andTree(...children: LogicNode[]): LogicNode {
return { id: genId(), type: 'AND', children };
}
/** 돈천 채널 — N일 최고가 상향 돌파 */
function donchianBreakoutBuy(period: number): LogicNode {
return condition('DONCHIAN', 'CROSS_UP', 'CLOSE_PRICE', `DC_UPPER_${period}`);
}
/** 돈천 채널 — N일 최저가 하향 이탈 */
function donchianBreakdownSell(period: number): LogicNode {
return condition('DONCHIAN', 'CROSS_DOWN', 'CLOSE_PRICE', `DC_LOWER_${period}`);
}
/** 일목균형표 — 전환선(9일) / 기준선(26일) 골든·데드크로스 */
function ichimokuTenkanKijunCross(signal: 'buy' | 'sell'): LogicNode {
return condition(
'ICHIMOKU',
signal === 'buy' ? 'CROSS_UP' : 'CROSS_DOWN',
'CONVERSION_LINE',
'BASE_LINE',
);
}
/** 33변곡 매수 — 바닥권 시간변곡(약 33거래일 주기) 전환 구간 */
export function build33InflectionBuyTree(): LogicNode {
return andTree(
@@ -93,6 +113,62 @@ export function getStrategyTemplates(def: DefType): StrategyTemplateDef[] {
description: '상승 5파 끝 변곡 — RSI 과매수 + MA 데드크로스 + 20일선·이격도 이탈',
build: build33InflectionSellTree,
},
{
kind: 'composite',
signal: 'buy',
label: '돈천 채널(20일) 매수',
description: '종가가 직전 20거래일 최고가(상단선)를 상향 돌파 — 한 달 박스권 돌파',
build: () => donchianBreakoutBuy(20),
},
{
kind: 'composite',
signal: 'sell',
label: '돈천 채널(20일) 매도',
description: '종가가 직전 20거래일 최저가(하단선)를 하향 이탈 — 추세 이탈 청산',
build: () => donchianBreakdownSell(20),
},
{
kind: 'composite',
signal: 'buy',
label: '터틀 S1 매수',
description: '단기 시스템 — 20일 최고가 돌파 진입 (리처드 데니스 터틀 트레이딩)',
build: () => donchianBreakoutBuy(20),
},
{
kind: 'composite',
signal: 'sell',
label: '터틀 S1 청산',
description: '단기 시스템 — 10일 최저가 이탈 시 즉시 청산 (진입보다 짧은 손절)',
build: () => donchianBreakdownSell(10),
},
{
kind: 'composite',
signal: 'buy',
label: '터틀 S2 매수',
description: '장기 시스템 — 55일 최고가 돌파 진입 (큰 추세 포착)',
build: () => donchianBreakoutBuy(55),
},
{
kind: 'composite',
signal: 'sell',
label: '터틀 S2 청산',
description: '장기 시스템 — 20일 최저가 이탈 시 청산 (S1보다 여유, S2보다 빠른 탈출)',
build: () => donchianBreakdownSell(20),
},
{
kind: 'composite',
signal: 'buy',
label: '일목 전환/기준선 매수',
description: '전환선(9일 중간값)이 기준선(26일 중간값)을 상향 돌파 — 골든크로스',
build: () => ichimokuTenkanKijunCross('buy'),
},
{
kind: 'composite',
signal: 'sell',
label: '일목 전환/기준선 매도',
description: '전환선(9일)이 기준선(26일)을 하향 이탈 — 데드크로스',
build: () => ichimokuTenkanKijunCross('sell'),
},
];
}