Dear support team,
Please, investigate the following issue.
Opt Input Parameter is reset to NULL with warning below. It is not regular, but can happen from time to time when changing any Opt Input Parameter.
WARNING chartbuilder.m ] Failed to edit indicator [EXAMPIND] due : null
If it is happened, I have to remove and add indicator again.
See, indicator code below.
package jforex;
import com.dukascopy.api.indicators.*;
import com.dukascopy.api.indicators.IIndicator;
import com.dukascopy.api.indicators.IIndicatorContext;
import com.dukascopy.api.indicators.IndicatorInfo;
import com.dukascopy.api.indicators.IndicatorResult;
import com.dukascopy.api.indicators.InputParameterInfo;
import com.dukascopy.api.indicators.OptInputParameterInfo;
import com.dukascopy.api.indicators.OutputParameterInfo;
import com.dukascopy.api.indicators.StringOptInputDescription;
public class Indicator implements IIndicator {
private IndicatorInfo indicatorInfo;
private InputParameterInfo[] inputParameterInfos;
private OptInputParameterInfo[] optInputParameterInfos;
private OutputParameterInfo[] outputParameterInfos;
private double[][] inputs = new double[1][];
private String timePeriod = "0.1";
private String timePeriod2 = "0.2";
private String timePeriod3 = "0.3";
private String timePeriod4 = "0.4";
private double[][] outputs = new double[1][];
public void onStart(IIndicatorContext context) {
indicatorInfo = new IndicatorInfo("EXAMPIND", "Sums previous values", "My indicators", false, false, false, 1, 4, 1);
inputParameterInfos = new InputParameterInfo[] {new InputParameterInfo("Input data", InputParameterInfo.Type.DOUBLE)};
optInputParameterInfos = new OptInputParameterInfo[] {
new OptInputParameterInfo("Time period", OptInputParameterInfo.Type.OTHER, new StringOptInputDescription(timePeriod)),
new OptInputParameterInfo("Time period 2", OptInputParameterInfo.Type.OTHER, new StringOptInputDescription(timePeriod2)),
new OptInputParameterInfo("Time period 3", OptInputParameterInfo.Type.OTHER, new StringOptInputDescription(timePeriod3)),
new OptInputParameterInfo("Time period 3", OptInputParameterInfo.Type.OTHER, new StringOptInputDescription(timePeriod4))
};
outputParameterInfos = new OutputParameterInfo[] {
new OutputParameterInfo("out", OutputParameterInfo.Type.DOUBLE, OutputParameterInfo.DrawingStyle.LINE)
};
}
public IndicatorResult calculate(int startIndex, int endIndex) {
//calculating startIndex taking into account lookback value
if (startIndex - getLookback() < 0) {
startIndex -= startIndex - getLookback();
}
int i, j;
for (i = startIndex, j = 0; i <= endIndex; i++, j++) {
outputs[0][j] = Double.valueOf(timePeriod) + Double.valueOf(timePeriod2) + Double.valueOf(timePeriod3) + Double.valueOf(timePeriod4);
}
return new IndicatorResult(startIndex, j);
}
public IndicatorInfo getIndicatorInfo() {
return indicatorInfo;
}
public InputParameterInfo getInputParameterInfo(int index) {
if (index <= inputParameterInfos.length) {
return inputParameterInfos[index];
}
return null;
}
public int getLookback() {
return 0;
}
public int getLookforward() {
return 0;
}
public OptInputParameterInfo getOptInputParameterInfo(int index) {
if (index <= optInputParameterInfos.length) {
return optInputParameterInfos[index];
}
return null;
}
public OutputParameterInfo getOutputParameterInfo(int index) {
if (index <= outputParameterInfos.length) {
return outputParameterInfos[index];
}
return null;
}
public void setInputParameter(int index, Object array) {
inputs[index] = (double[]) array;
}
public void setOptInputParameter(int index, Object value) {
// if (null != value){return;}
switch (index) {
case 0:
timePeriod = (String) value;
break;
case 1:
timePeriod2 = (String) value;
break;
case 2:
timePeriod3 = (String) value;
break;
case 3:
timePeriod4 = (String) value;
break;
default:
throw new ArrayIndexOutOfBoundsException(index);
}
}
public void setOutputParameter(int index, Object array) {
outputs[index] = (double[]) array;
}
}
JForex 2.27.2
JForex API 2.9.3
Java Web Start 10.40.2.43
Using JRE version 1.7.0_40-b43 Java HotSpot(TM) Server VM
OS Kubuntu
Thank you in advanced.