단순이동평균선 이름 표시방식 변경

This commit is contained in:
Macbook
2026-06-13 01:36:03 +09:00
parent 207374a08e
commit beeebed8f4
13 changed files with 106 additions and 51 deletions
@@ -1342,31 +1342,19 @@ public class StrategyDslToTa4jAdapter {
return -1;
}
/** live-conditions·해석 UI — MA5(60일) 형식 */
/** live-conditions·해석 UI — MA20일 형식 (슬롯·기간 설정값 기준) */
public String formatMovingAverageFieldLabel(String field, Map<String, Map<String, Object>> params) {
if (field == null || field.isBlank()) return field;
Map<String, Object> sma = params != null ? params.getOrDefault("SMA", Map.of()) : Map.of();
if (field.startsWith("MA") && !field.startsWith("MACD")) {
int period = resolveMovingAveragePeriod(field, "MA", sma);
if (period <= 0) return field;
try {
int n = Integer.parseInt(field.substring(2));
if (n >= 1 && n <= MA_DSL_SLOT_MAX) return "MA" + n + "(" + period + "일)";
return "MA(" + period + "일)";
} catch (NumberFormatException e) {
return field;
}
return "MA" + period + "";
}
if (field.startsWith("EMA")) {
int period = resolveMovingAveragePeriod(field, "EMA", sma);
if (period <= 0) return field;
try {
int n = Integer.parseInt(field.substring(3));
if (n >= 1 && n <= MA_DSL_SLOT_MAX) return "EMA" + n + "(" + period + "일)";
return "EMA(" + period + "일)";
} catch (NumberFormatException e) {
return field;
}
return "EMA" + period + "";
}
return field;
}