Other values are plotted on the chart, and other value returns indicators.dema (...)
Below is a simple strategy which prints the value of DEMA (200) for the last 50 candles (which can be compared with the graph)
When can I expect to improve it?
package jforex;
import java.util.*;
import java.text.SimpleDateFormat;
import com.dukascopy.api.*;
public class DEMAtest implements IStrategy {
private IEngine engine;
private IConsole console;
private IHistory history;
private IContext context;
private IIndicators indicators;
@Configurable("Instrument:") public Instrument instrumentThis = Instrument.EURUSD;
@Configurable(value="Period:") public Period periodThis = Period.FIVE_MINS;
@Configurable(value="DEMAperiod:") public int DEMAperiod = 200;
@Configurable(value="numberOfCandels:") public int numberOfCandels = 50;
public void onStart(IContext context) throws JFException {
this.engine = context.getEngine();
this.console = context.getConsole();
this.history = context.getHistory();
this.context = context;
this.indicators = context.getIndicators();
}
public void onAccount(IAccount account) throws JFException {
}
public void onMessage(IMessage message) throws JFException {
}
public void onStop() throws JFException {
}
public void onTick(Instrument instrument, ITick tick) throws JFException {
}
public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
if(instrument == instrumentThis){
if(period == periodThis){
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm,ss");
List<IBar> BarListDT = history.getBars(instrument, period, OfferSide.BID, Filter.WEEKENDS, numberOfCandels, bidBar.getTime(), 0);
double[] DTdema = indicators.dema(instrument, period, OfferSide.BID, IIndicators.AppliedPrice.CLOSE, DEMAperiod, Filter.WEEKENDS, numberOfCandels, bidBar.getTime(), 0);
for(int i=0;i<DTdema.length;i++){
console.getOut().println(instrument.name()+" "+i+" time: "+formatter.format( new Date(BarListDT.get(i).getTime()-3600000*2))+": dema: "+DTdema[i]+ " high: "+BarListDT.get(i).getHigh()+" low: "+BarListDT.get(i).getLow());
}
}
}
}
}