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.

Filtering the weekly flats in getBar()
 Post subject: Filtering the weekly flats in getBar() Post rating: 0   New post Posted: Fri 24 May, 2013, 13:55 

User rating: 0
Joined: Sun 19 May, 2013, 20:17
Posts: 1
Hello.
Is it possible to change the getBar() method behavior, for it to omit the weekend flat bars?
...maybe i need to apply Filter.WEEKENDS somewhere, but i couldnt find out how to do it...

thanks :|


 
 Post subject: Re: Filtering the weekly flats in getBar() Post rating: 0   New post Posted: Fri 24 May, 2013, 15:43 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Then you need to subscribe to a custom feed, e.g.:
   @Override
   public void onStart(IContext context) throws JFException {
      console = context.getConsole();
      IFeedDescriptor feedDescriptor = new TimePeriodAggregationFeedDescriptor(Instrument.EURUSD, Period.ONE_HOUR, OfferSide.ASK, Filter.WEEKENDS);
      context.subscribeToFeed(feedDescriptor, this);
   }

   @Override
   public void onFeedData(IFeedDescriptor feedDescriptor, ITimedData feedData) {
      console.getErr().println("IFeedListener.onFeedData: " + feedData);
      // if you want to retrieve concrete prices you need to use cast e.g.: ((IBar)feedData).getClose()
   }

Run the attached strategy in Historical Tester over the timespan that includes weekend to see that the onFeedData does not receive the weekend bars. Read more on feeds here:
https://www.dukascopy.com/wiki/#Chart_feeds


Attachments:
FilteredOnBar.java [1.56 KiB]
Downloaded 332 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.
 

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