Hello,
A small function, I hope it will help.
double[] getMaFromArray(double[] valArray, IIndicators.MaType matype, int timePeriod) {
IIndicator ma;
ma = indicators.getIndicator("ma");
//inputs
ma.setInputParameter(0, valArray); //Value Array
ma.setOptInputParameter(0, timePeriod);//Time Period
ma.setOptInputParameter(1, matype.ordinal()); //MA Type
//outputs
int length = valArray.length - timePeriod+1; //Calculation Length of Result
double[] result = new double[length];
ma.setOutputParameter(0,result);
ma.calculate(0, valArray.length-1);
return result;
}