전략편집기 저장오휴 수정

This commit is contained in:
Macbook
2026-06-21 23:24:18 +09:00
parent 8a901e5b26
commit 827ef7cac4
2 changed files with 25 additions and 7 deletions
@@ -83,4 +83,21 @@ function migrateK(cond) {
const migrated = migrateK({ indicatorType: 'RSI', rightField: 'K_55', thresholdOverride: false });
assertOk('migrate K_55 stays K_55', migrated.rightField === 'K_55' && migrated.targetValue === 55);
// 비-임계값 rightField (RSI 신호선 등) — 로드 시 기본 과열선으로 되돌리지 않음
function migrateRightField(cond, signalType = 'buy') {
if (cond.thresholdOverride === true) return cond;
let rightField = cond.rightField;
if (rightField?.startsWith('K_')) return cond;
const THRESHOLD = new Set(['HL_OVER', 'HL_MID', 'HL_UNDER']);
const RSI_RIGHT_OPTS = ['RSI_SIGNAL', 'NONE', 'HL_OVER', 'HL_MID', 'HL_UNDER'];
if (!rightField) {
rightField = 'HL_OVER';
} else if (!THRESHOLD.has(rightField) && !rightField.startsWith('K_')) {
if (!RSI_RIGHT_OPTS.includes(rightField)) rightField = 'HL_OVER';
}
return { ...cond, rightField, thresholdOverride: false };
}
const rsiSignal = migrateRightField({ indicatorType: 'RSI', rightField: 'RSI_SIGNAL', conditionType: 'CROSS_UP' });
assertOk('RSI_SIGNAL preserved on load', rsiSignal.rightField === 'RSI_SIGNAL');
process.exit(failed > 0 ? 1 : 0);