Dukascopy
 
 
Wiki JStore Search Login

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

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

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

URGENT: Indicator API Problem with context.getFeedDescriptor()
 Post subject: URGENT: Indicator API Problem with context.getFeedDescriptor() Post rating: 0   New post Posted: Thu 05 Mar, 2015, 14:41 
User avatar

User rating: 0
Joined: Tue 30 Jul, 2013, 23:11
Posts: 10
Location: United Kingdom, Reading
Dear Support,

I created the attached TestIndicator.java to reproduce the problem I'm facing using the sample code provided by Dukascopy API.
TestStrategy.java is a sample strategy that calculates the indicator and also add the indicator on a chart.
TestStrategyRunWithGUI.java is a modified version of singlejartest.TesterMainGUIMode sample from the API, this is to historically test the strategy

When the indicator is invoked from the TestIndicator.onBar(...) methods to calculate, context.getFeedDescriptor() is properly initialised and return all the necessary values;
When the indicator in invoked by the chart to calculate, context.getFeedDescriptor() is null
Please see the attached Error.txt

Am I missing a step when adding the indicator on the chart or is this a bug in the API?

Thanks,
Regards,

Serge.


Attachments:
Error.txt [82.19 KiB]
Downloaded 73 times
TestIndicator.java [3.56 KiB]
Downloaded 64 times
TestStrategyRunWithGUI.java [12.69 KiB]
Downloaded 47 times
TestStrategy.java [3.6 KiB]
Downloaded 53 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: URGENT: Indicator API Problem with context.getFeedDescriptor() Post rating: 0   New post Posted: Thu 05 Mar, 2015, 20:28 
User avatar

User rating: 0
Joined: Tue 30 Jul, 2013, 23:11
Posts: 10
Location: United Kingdom, Reading
Any help?


 
 Post subject: Re: URGENT: Indicator API Problem with context.getFeedDescriptor() Post rating: 0   New post Posted: Fri 06 Mar, 2015, 13:12 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
When an indicator is instantiated by indicators.getIndicator("TestIndicator") there is no way to know where this indicator is going to be used and what the FeedDescriptor will be.
One workaround could be to set feedDescriptor into the indicator manually through a custom method like so:
indicators.registerCustomIndicator(TestIndicator.class);
TestIndicator testIndicator = indicators.getIndicator("TestIndicator");
chart=context.getLastActiveChart();
testIndicator.setFeed(chart.getFeedDescriptor());


 

Jump to:  

  © 1998-2024 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