Hi Support,
thanks for the example. One additional question. Although the calculation statement in the onBar method works fine, when trying to access CustomIndicator in the onStart method already, it produces following null pointer error.
BTW, in case there is a separate class file CustomIndicator.jfx or when accessing one of the standard indicators, it does not produce this error. Any idea what is going wrong?
public void onStart(IContext context) throws JFException {
...
indicators.registerCustomIndicator(CustomIndicator.class);
[color=#FF0000] indicator = indicators.getIndicator("CustomIndicator");[/color]
...
}
public void onBar(Instrument instrument, Period period, IBar askbar, IBar bidbar) throws JFException {
...
Object[] myIndicator = this.indicators.calculateIndicator(instrument, period, new OfferSide[] {OfferSide.BID}, "CustomIndicator",
new IIndicators.AppliedPrice[] {appliedPrice}, new Object[]{20}, indicatorFilter, 1, timeStamp, 0);
...
}
SEVERE Exception thrown whiler running onStart method: null java.lang.NullPointerException
at jforex.BBSMA_apr.onStart(BBSMA_apr.java:55)
at com.dukascopy.api.impl.execution.s.call(Unknown Source)
at com.dukascopy.api.impl.connect.an.a(Unknown Source)
at com.dukascopy.api.impl.connect.v.call(Unknown Source)
at com.dukascopy.api.impl.connect.v.call(Unknown Source)
at com.dukascopy.api.impl.execution.i.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at com.dukascopy.api.impl.execution.e$a.f(Unknown Source)
at com.dukascopy.api.impl.execution.e$a.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)