如题 请求帮助 谢谢
private int period = 0; // default = DAILY
private int lookback = 2; // DAILY *2
public IndicatorResult calculate(int startIndex, int endIndex) {
int inputLength = inputs[1].length - 1;
if ( inputLength < lookback || startIndex > endIndex ||
calculationTimeframe.getPeriod().isSmallerThan(displayTimeframe.getPeriod()) )
{
new IndicatorResult(0, 0);
}
int lastBar = -1;
if (inputs[1].length > lookback)
{
lastBar = getTimeIndex(inputs[1][inputs[1].length - lookback].getTime(), inputs[0]);
}
if (lastBar == -1)
{
new IndicatorResult(0, 0);
}
if (startIndex != endIndex) {
highest = 0.0;
lowest = 0.0;
}
//这里想要指标起始时间从以前一天或二天到现在最新BAR数来运算。
for ( i = inputs[0].length-1,j=0; i > lastBar; i--,j--) {
double todayHigh = inputs[0][i].getHigh();
double todayLow = inputs[0][i].getLow();
....
....
outputs[0][j] = Double.parseDouble();
}
return new IndicatorResult(startIndex, j);
}