getSecondaryMaxMinValue method
Implementation
void getSecondaryMaxMinValue(KLineEntity item) {
for (var secondaryState in secondaryStates) {
// print(
// 'State: $secondaryState, MACD: ${item.macd}, DIF: ${item.dif}, DEA: ${item.dea}');
// print('Calculating SecondaryState: $secondaryState');
// print('MACD: ${item.macd}, DIF: ${item.dif}, DEA: ${item.dea}');
// print('KDJ: K=${item.k}, D=${item.d}, J=${item.j}');
// print('RSI: ${item.rsi}, WR: ${item.r}, CCI: ${item.cci}');
double mSecondaryMaxValue = double.minPositive;
double mSecondaryMinValue = double.maxFinite;
if (secondaryState == SecondaryState.MACD) {
if (item.macd != null) {
mSecondaryMaxValue = math.max(mSecondaryMaxValue,
math.max(item.macd!, math.max(item.dif!, item.dea!)));
mSecondaryMinValue = math.min(mSecondaryMinValue,
math.min(item.macd!, math.min(item.dif!, item.dea!)));
}
} else if (secondaryState == SecondaryState.KDJ) {
if (item.d != null) {
mSecondaryMaxValue = math.max(mSecondaryMaxValue,
math.max(item.k!, math.max(item.d!, item.j!)));
mSecondaryMinValue = math.min(mSecondaryMinValue,
math.min(item.k!, math.min(item.d!, item.j!)));
}
} else if (secondaryState == SecondaryState.RSI) {
if (item.rsi != null) {
mSecondaryMaxValue = math.max(mSecondaryMaxValue, item.rsi!);
mSecondaryMinValue = math.min(mSecondaryMinValue, item.rsi!);
}
} else if (secondaryState == SecondaryState.WR) {
mSecondaryMaxValue = 0;
mSecondaryMinValue = -100;
} else if (secondaryState == SecondaryState.CCI) {
if (item.cci != null) {
mSecondaryMaxValue = math.max(mSecondaryMaxValue, item.cci!);
mSecondaryMinValue = math.min(mSecondaryMinValue, item.cci!);
}
} else {
mSecondaryMaxValue = 0;
mSecondaryMinValue = 0;
}
// 添加日志
// print('[getSecondaryMaxMinValue] State: $secondaryState, '
// 'Max: $mSecondaryMaxValue, Min: $mSecondaryMinValue');
}
}