Hi Guys,
I am quite new to this and was just trying to get the MACD value using the following code but unfortunately when I check against the Demo graph from the "https://www.dukascopy.com/client/demo/jclient/jforex.jnlp" the values dont match up.
public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) {
console.getOut().println("Before");
try {
String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss";
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
double [] macd0= indicators.macd(instrument, Period.ONE_MIN, OfferSide.BID, IIndicators.AppliedPrice.MEDIAN_PRICE, 12, 26, 9, 0) ;
double macd=macd0[0];
DecimalFormat df = new DecimalFormat("#.#######");
console.getOut().println("MACD=" + df.format(macd) + " Time = " + sdf.format(bidBar.getTime()));
} catch (JFException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Please advise what I am doing wrong.
Thank you for your time in advance.