Dukascopy
 
 
Wiki JStore Search Login

JFOREX-3632 calculateIndicator with FeedDescriptors and SAR
 Post subject: JFOREX-3632 calculateIndicator with FeedDescriptors and SAR Post rating: 0   New post Posted: Wed 21 Mar, 2012, 12:08 

User rating: 0
Joined: Wed 21 Mar, 2012, 11:54
Posts: 2
Hello,

I have troubles getting the same values as the chart for the SAR
indicator when using the universal method with feed descriptors.

           // This works :
            print("SAR : "+ indicators.sar(Instrument.EURUSD, Period.ONE_MIN, OfferSide.BID, 0.02, 0.2, 0));
           
            // This doesn't
            FeedDescriptor feed = new FeedDescriptor();
            feed.setPeriod(Period.ONE_MIN);
            feed.setInstrument(Instrument.EURUSD);
            feed.setDataType(DataType.TIME_PERIOD_AGGREGATION);
            feed.setOfferSide(OfferSide.BID);
            feed.setFilter(Filter.NO_FILTER);
           
            Object[] output = indicators.calculateIndicator(feed,new OfferSide[]{feed.getOfferSide()}, "SAR", new AppliedPrice[] { null }, new Object[] { 0.02, 0.2 }, 0);
            print("Sar feed : [0] " + output[0]);
            output = indicators.calculateIndicator(feed,new OfferSide[]{feed.getOfferSide()}, "SAR", null, new Object[] { 0.02, 0.2 }, 0);
            print("Sar feed : [1] " + output[0]);
            output = indicators.calculateIndicator(feed,new OfferSide[]{feed.getOfferSide()}, "SAR", new AppliedPrice[] { AppliedPrice.CLOSE }, new Object[] { 0.02, 0.2 }, 0);
            print("Sar feed : [2] " + output[0]);


I'm attaching a strategy with the different things I tried. Maybe you
could help me figure out what to do .. or is it a bug ?

Thanks and regards


Attachments:
File comment: attempts
SARIssue.java [5.42 KiB]
Downloaded 331 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: universal calculateIndicator with FeedDescriptors and SAR vs Chart Post rating: 0   New post Posted: Wed 21 Mar, 2012, 15:04 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Have you taken a look at the following?
https://www.dukascopy.com/wiki/#Indicato ... price_feed
Also try:
https://www.dukascopy.com/wiki/#Calculat ... _on_a_feed


 
 Post subject: Re: universal calculateIndicator with FeedDescriptors and SAR vs Chart Post rating: 0   New post Posted: Wed 21 Mar, 2012, 15:52 

User rating: 0
Joined: Wed 21 Mar, 2012, 11:54
Posts: 2
I went through the documentation before posting and used some of it to try to achieve my goal without success.
I've attached the source code to reproduce my issue : add the SAR indicator to a EURUSD , 1Min, Bid chart, the non universal way works, none of the multiple universal attempts are actually the same

Maybe someone can test and confirm the issue and/or submit the correct way to do it if they get it to work.


 

Jump to:  

cron
  © 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