전략 수정
This commit is contained in:
@@ -393,6 +393,10 @@ public class StrategyDslToTa4jAdapter {
|
||||
if (children.isArray()) {
|
||||
for (JsonNode child : children) list.add(toRule(child, ctx));
|
||||
}
|
||||
JsonNode single = node.path("child");
|
||||
if (list.isEmpty() && !single.isMissingNode() && !single.isNull()) {
|
||||
list.add(toRule(single, ctx));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -810,7 +814,7 @@ public class StrategyDslToTa4jAdapter {
|
||||
int period = parseTrailingInt(field, "CCI_VALUE_", intP(p, "length", 13));
|
||||
return new CciOnSourceIndicator(resolvePriceSource(s, CciOnSourceIndicator.normalizeParams(p)), period);
|
||||
}
|
||||
if (field.equals("CCI_VALUE") || indType.equals("CCI"))
|
||||
if (field.equals("CCI_VALUE"))
|
||||
return new CciOnSourceIndicator(resolvePriceSource(s, CciOnSourceIndicator.normalizeParams(p)),
|
||||
effectivePeriod(periodOverride, p, "length", 13));
|
||||
if (field.equals("CCI_SIGNAL")) {
|
||||
@@ -894,7 +898,7 @@ public class StrategyDslToTa4jAdapter {
|
||||
int len = parseTrailingInt(field, "TRIX_VALUE_", intP(p, "length", 12));
|
||||
return buildTrixLine(close, len);
|
||||
}
|
||||
if (field.equals("TRIX_VALUE") || indType.equals("TRIX")) {
|
||||
if (field.equals("TRIX_VALUE")) {
|
||||
return buildTrixLine(close, effectivePeriod(periodOverride, p, "length", 12));
|
||||
}
|
||||
if (field.equals("TRIX_SIGNAL")) {
|
||||
@@ -1561,14 +1565,16 @@ public class StrategyDslToTa4jAdapter {
|
||||
int periodOverride, String lengthKey, int defaultLen) {
|
||||
if (cond != null && !cond.isNull()) {
|
||||
String leftField = cond.path("leftField").asText("");
|
||||
if (leftField.startsWith(valuePrefix + "_")) {
|
||||
int fromField = parseTrailingInt(leftField, valuePrefix + "_", defaultLen);
|
||||
if (fromField > 0) return fromField;
|
||||
if (leftField.equals(valuePrefix) || leftField.startsWith(valuePrefix + "_")) {
|
||||
if (leftField.startsWith(valuePrefix + "_")) {
|
||||
int fromField = parseTrailingInt(leftField, valuePrefix + "_", defaultLen);
|
||||
if (fromField > 0) return fromField;
|
||||
}
|
||||
int leftPeriod = cond.path("leftPeriod").asInt(-1);
|
||||
if (leftPeriod > 0) return leftPeriod;
|
||||
int condPeriod = cond.path("period").asInt(-1);
|
||||
if (condPeriod > 0) return condPeriod;
|
||||
}
|
||||
int leftPeriod = cond.path("leftPeriod").asInt(-1);
|
||||
if (leftPeriod > 0) return leftPeriod;
|
||||
int condPeriod = cond.path("period").asInt(-1);
|
||||
if (condPeriod > 0) return condPeriod;
|
||||
}
|
||||
return effectivePeriod(periodOverride, p, lengthKey, defaultLen);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user