전략평가 오류 수정
This commit is contained in:
@@ -57,8 +57,8 @@ public class StrategySignalDeterminer {
|
||||
int index, String positionMode) {
|
||||
try {
|
||||
if ("SIGNAL_ONLY".equals(positionMode)) {
|
||||
boolean enterOk = entryRule != null && isRisingEdge(entryRule, index);
|
||||
boolean exitOk = exitRule != null && isRisingEdge(exitRule, index);
|
||||
boolean enterOk = entryRule != null && entryRule.isSatisfied(index);
|
||||
boolean exitOk = exitRule != null && exitRule.isSatisfied(index);
|
||||
if (enterOk) return "BUY";
|
||||
if (exitOk) return "SELL";
|
||||
return "NONE";
|
||||
@@ -84,15 +84,10 @@ public class StrategySignalDeterminer {
|
||||
}
|
||||
|
||||
private String determineSignalOnly(Strategy strategy, int index) {
|
||||
if (isRisingEdge(strategy.getEntryRule(), index)) return "BUY";
|
||||
if (isRisingEdge(strategy.getExitRule(), index)) return "SELL";
|
||||
Rule entry = strategy.getEntryRule();
|
||||
Rule exit = strategy.getExitRule();
|
||||
if (entry != null && entry.isSatisfied(index)) return "BUY";
|
||||
if (exit != null && exit.isSatisfied(index)) return "SELL";
|
||||
return "NONE";
|
||||
}
|
||||
|
||||
/** GTE 등 유지형 조건 — 충족 시작 봉만 true (연속 시그널 방지) */
|
||||
private boolean isRisingEdge(Rule rule, int index) {
|
||||
if (rule == null || !rule.isSatisfied(index)) return false;
|
||||
if (index <= 0) return true;
|
||||
return !rule.isSatisfied(index - 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user