Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Submit JForex API bug reports in this forum only.
    Submit Converter issues in Converter Issues.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Re:different indicator values between from api and on chart
 Post subject: Re:different indicator values between from api and on chart Post rating: 0   Post Posted: Fri 13 Mar, 2015, 17:06 
User avatar

User rating: 0
Joined: Fri 06 Mar, 2015, 11:56
Posts: 19
Location: ChinaChina
I am new.

1. I finished a strategy and found suddenly that the value from indicator function,like MACD, MA, Alligator, is different than that shown on charts.

2. The points with indicator values by it on charts when pointed by mouse are not on the indicator lines accurately but near it.

3. Jforex data and candles are good. Some indicator, however, is different than some other famous, long history platforms. I was wondering which is correct.

Could someone help explain? Thx.


 
 Post subject: Re: Re:different indicator values between from api and on chart Post rating: 0   Post Posted: Mon 16 Mar, 2015, 13:23 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please check that the following is true:
https://www.dukascopy.com/wiki/#Indicat ... _checklist


 
 Post subject: Re: Re:different indicator values between from api and on chart Post rating: 0   Post Posted: Mon 16 Mar, 2015, 14:23 
User avatar

User rating: 0
Joined: Fri 06 Mar, 2015, 11:56
Posts: 19
Location: ChinaChina
Thank for your reply.

1. The points with indicator values by it is on the the lines now. It is amazing you guys improved it so quickly.

2. I changed JForex preference>GMT, FlatsFilter, and offerside. I use OnTick method not OnBar method.
But nothing changes.

3. I downloaded a strategy made by DUKASCOPY: simpleEMA. I found that it also has the same problem as shown in attached picture with chart and code and running results.

Image

Could you please do a test with it by yourself, and explain that for me?

BRDS!


Attachments:
DIFF EMA IN STRATEGY THAN CHART.png [148.25 KiB]
Downloaded 509 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Re:different indicator values between from api and on chart Post rating: 0   Post Posted: Tue 17 Mar, 2015, 14:30 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
EMA uses unstable period, so there could be a difference...
More on this here:
https://ta-lib.org/d_api/ta_setunstableperiod.html
https://www.dukascopy.com/swiss/english ... 84&p=79104


 
 Post subject: Re: Re:different indicator values between from api and on chart Post rating: 0   Post Posted: Wed 18 Mar, 2015, 02:11 
User avatar

User rating: 0
Joined: Fri 06 Mar, 2015, 11:56
Posts: 19
Location: ChinaChina
Mr. Support and tcsabina:

Could you just give me the functions and parameters of indicator MACD and ALLIGATOR. so I can get as accurate values as on charts.

Waiting for your reply.

Thanks!


 
 Post subject: Re: Re:different indicator values between from api and on chart Post rating: 0   Post Posted: Wed 18 Mar, 2015, 15:01 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Here is an example
    
public void onStart(IContext context) throws JFException {
        this.console = context.getConsole();
        this.history = context.getHistory();
        this.indicators = context.getIndicators();

        IChart chart = context.getChart(Instrument.EURUSD);
        IFeedDescriptor feedDescriptor = chart.getFeedDescriptor();
        IBar bar = history.getBar(feedDescriptor.getInstrument(), feedDescriptor.getPeriod(), feedDescriptor.getOfferSide(), 1);
        Object[] results = indicators.calculateIndicator(
                chart.getFeedDescriptor(),
                new OfferSide[]{OfferSide.BID},
                "EMA",
                new IIndicators.AppliedPrice[]{IIndicators.AppliedPrice.CLOSE},
                new Object[]{4},
                400, bar.getTime(), 0);
        double[] arr = (double[]) results[0];
        console.getOut().println(toStr(arr[399]));
    }

    public String toStr(double d) {
        return (new DecimalFormat("#.#######")).format(d);
    }


 
 Post subject: Re: Re:different indicator values between from api and on chart Post rating: 0   Post Posted: Thu 19 Mar, 2015, 08:25 
User avatar

User rating: 0
Joined: Fri 06 Mar, 2015, 11:56
Posts: 19
Location: ChinaChina
I cannot get the expected values all the same. I don't think they use the same Algorithm in indicators and api. Thanks a lot, any way. :)


 
 Post subject: Re: Re:different indicator values between from api and on chart Post rating: 0   Post Posted: Fri 20 Mar, 2015, 03:56 
User avatar

User rating: 0
Joined: Fri 06 Mar, 2015, 11:56
Posts: 19
Location: ChinaChina
Hi, Mr. Support:
I think I finally found the bug.
I get the last 100 four hours Close of EURJPY by entering the following codes:

double [] close = new double [100];
for (int i=100-1; i>=0; i--) {
close [i] = history.getBar(Instrument.EURJPY,Period.FOUR_HOURS,OfferSide.BID,i).getClose();
console.getOut().println(i + " " + close[i]);
}

See what I found:
Image

Image

The EURJPY four hours Close from Bar26 to Bar37 are all 127.376 and Close from Bar68 to Bar79 are all 130.981.
Is this a bug and does it make wrong indication function output?
Could you please have them all fixed?
Waiting for your reply.
Best Regards!


Attachments:
360截图20150320104818144.png [28.13 KiB]
Downloaded 540 times
360截图20150320104620964.png [39.27 KiB]
Downloaded 513 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
The Best Answer  Post subject: Re: Re:different indicator values between from api and on chart Post rating: 0   Post Posted: Fri 20 Mar, 2015, 14:39 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
That is not a bug. Method getBar does not have Filter parameter and empty bars are not filtered out. To see these values on chart please set Tools > Preferences > Chart > Flats Filter is disabled.


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com