我从 TA-LIB Mama 指标中得到了奇怪的结果。
使用相同价格数组调用其他指标会给出正确的结果。
但是要求core.mama()
给 Mama 的价值是一两个点,而 Fama 的价值高达 30 个点。我正在与 JForex 中的值进行比较,我已经针对其他平台进行了验证。
我通过调用 TA-LIB 来设置价格数组的长度,但更长的回溯不会改善结果:
int priceLength = core.mamaLookback(fastLimit, slowLimit) + 1;
我对 fastLimit 和 slowLimit 的设置在合理的范围内。
将参数更改startIdx
为 0 并返回更多值也无济于事。
代码非常简单,很难看出我做错了什么。我是不是脑子有屁,还是图书馆被窃听了?
public static double[] runMama(double[] prices, double fastLimit, double slowLimit) {
try {
MInteger outBegIdx = new MInteger();
MInteger outNbElement = new MInteger();
int count = prices.length;
Core core = new Core();
// We only need the most recent value.
double[] outputFama = new double[1];
double[] outputMama = new double[1];
RetCode retCode = core.mama(count-1, count-1, prices, fastLimit, slowLimit, outBegIdx, outNbElement, outputMama, outputFama);
if (retCode != RetCode.Success) {
throw new RuntimeException("TA-LIB Mama has barfed!");
}
return new double[]{outputMama[0], outputFama[0]};
} catch (Exception e) {
Printer.printErr("Problem with MESA", e);
return null;
}
}