일목균형표 전략지표 추가

This commit is contained in:
Macbook
2026-06-16 20:40:42 +09:00
parent bf208a7ace
commit 1bc275fc53
6 changed files with 136 additions and 11 deletions
@@ -501,8 +501,17 @@ public class StrategyDslToTa4jAdapter {
case "SPAN1_LT_SPAN2" -> new UnderIndicatorRule(ichimokuSpanA(series, indParams), ichimokuSpanB(series, indParams));
case "SPAN1_CROSS_UP_SPAN2" -> new CrossedUpIndicatorRule(ichimokuSpanA(series, indParams), ichimokuSpanB(series, indParams));
case "SPAN1_CROSS_DOWN_SPAN2" -> new CrossedDownIndicatorRule(ichimokuSpanA(series, indParams), ichimokuSpanB(series, indParams));
case "LAGGING_GT_PRICE" -> new OverIndicatorRule(ichimokuLagging(series, indParams), new ClosePriceIndicator(series));
case "LAGGING_LT_PRICE" -> new UnderIndicatorRule(ichimokuLagging(series, indParams), new ClosePriceIndicator(series));
case "LAGGING_GT_PRICE" -> buildChikouVsPriorCloseRule(series, indParams, true);
case "LAGGING_LT_PRICE" -> buildChikouVsPriorCloseRule(series, indParams, false);
case "LAGGING_ABOVE_PRIOR_CLOUD" -> buildChikouAbovePriorCloudRule(series, indParams);
case "VOLUME_GT_MA_RATIO" -> {
double ratio = cond.path("compareValue").asDouble(1.5);
int len = intP(indParams, "length", 5);
VolumeIndicator vol = new VolumeIndicator(series, 1);
SMAIndicator volMa = new SMAIndicator(vol, len);
Indicator<Num> threshold = NumericIndicator.of(volMa).multipliedBy(ratio);
yield new OverIndicatorRule(vol, threshold);
}
default -> {
log.warn("[Adapter] 미지원 conditionType: {}", condType);
yield new BooleanRule(false);
@@ -1026,6 +1035,25 @@ public class StrategyDslToTa4jAdapter {
return new IchimokuChikouSpanIndicator(s, ichimokuChikouDisplacement(p));
}
/** 후행스팬(현재 종가) vs chikouDisplacement 봉 전 종가 — 삼역호전 3-1 */
private Rule buildChikouVsPriorCloseRule(BarSeries s, Map<String, Object> p, boolean above) {
int d = ichimokuChikouDisplacement(p);
Indicator<Num> close = new ClosePriceIndicator(s);
Indicator<Num> priorClose = new PreviousValueIndicator(close, d);
return above
? new OverIndicatorRule(close, priorClose)
: new UnderIndicatorRule(close, priorClose);
}
/** 후행스팬(현재 종가) vs chikouDisplacement 봉 전 구름 상단 — 삼역호전 3-2 */
private Rule buildChikouAbovePriorCloudRule(BarSeries s, Map<String, Object> p) {
int d = ichimokuChikouDisplacement(p);
Indicator<Num> close = new ClosePriceIndicator(s);
NumericIndicator cloudTop = NumericIndicator.of(ichimokuSpanA(s, p)).max(ichimokuSpanB(s, p));
Indicator<Num> priorCloudTop = new PreviousValueIndicator(cloudTop, d);
return new OverIndicatorRule(close, priorCloudTop);
}
/** 종가가 구름 위 */
private Rule buildCloudAboveRule(BarSeries s, Map<String, Object> p) {
NumericIndicator cloudTop = NumericIndicator.of(ichimokuSpanA(s, p)).max(ichimokuSpanB(s, p));