TrojanKill wrote:
Hello, I observed that for the same parameters (12,26,9), classic MACD in JForex doesnt' give same results, same curve... compare MACD in Metatrader 4
Someone knows how to get the same MACD in MT4, in the JFOREX platform ?
Thanks.
I believe JForex indicators by default doesn't using Filter, weekend flat price feeds got the way into calculation.
Here is my fix:
// I want 2 natr values from last bar
// FastNatr with natrPeriod1
// SlowNatr with natrPeriod2
// indicator which filter out weekends flat
long from = history.getBar(instrument, period, OfferSide.BID, 2).getTime();
long to = history.getBar(instrument, period, OfferSide.BID, 1).getTime();
double natrFast[] = indicators.natr(instrument, period, side, natrPeriod1, Filter.WEEKENDS, from, to);
double natrSlow[] = indicators.natr(instrument, period, side, natrPeriod2, Filter.WEEKENDS, from, to);
// indicator which DOES NOT filter out weekends flat
double natrFast1 = indicators.natr(instrument, period, OfferSide.BID, natrPeriod1, 1);
double natrFast2 = indicators.natr(instrument, period, OfferSide.BID, natrPeriod1, 2);
double natrSlow1 = indicators.natr(instrument, period, OfferSide.BID, natrPeriod2, 1);
double natrSlow2 = indicators.natr(instrument, period, OfferSide.BID, natrPeriod2, 2);
I hope that solves your problem.