Dukascopy
 
 
Wiki JStore Search Login

history.getBars(...Filter.ALL_FLATS..) is broken
 Post subject: history.getBars(...Filter.ALL_FLATS..) is broken Post rating: 1   New post Posted: Tue 03 Dec, 2013, 11:22 
User avatar

User rating: 7
Joined: Tue 28 Feb, 2012, 09:45
Posts: 45
Location: JapanJapan
I think, history.getBars(...Filter.ALL_FLATS..) is broken.

This is sample strategy.
package jforex;

import com.dukascopy.api.*;
import java.text.SimpleDateFormat;
import java.util.TimeZone;
import java.util.Locale;

public class TestTemp implements IStrategy {

   
    public void onStart(IContext context) throws JFException {
        IConsole console = context.getConsole();
        IHistory history = context.getHistory();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss",Locale.US);
        sdf.setTimeZone(TimeZone.getTimeZone("Europe/London"));
        long lastBarStartTime = history.getStartTimeOfCurrentBar(Instrument.EURUSD, Period.ONE_HOUR);
        Filter[] filters = {Filter.WEEKENDS, Filter.ALL_FLATS};
        for(Filter filter: filters){
            IBar LastBar = history.getBars(Instrument.EURUSD, Period.ONE_HOUR, OfferSide.BID, filter, 1, lastBarStartTime, 0).get(0);
            console.getOut().println("Bar's Volume: " + LastBar.getVolume());
            console.getOut().println("Bar's StartTime: " + sdf.format(LastBar.getTime()));
            console.getOut().println("Filter: " + filter);
        }
        context.stop();
        return;
    }

    public void onAccount(IAccount account) throws JFException {
    }

    public void onMessage(IMessage message) throws JFException {
    }

    public void onStop() throws JFException {
    }

    public void onTick(Instrument instrument, ITick tick) throws JFException {
    }

    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
    }

}

And, Result is this.
Image
ALL_FLATS Filter did not working.

But, This case was working.
Image

Why??

Best regards,


Attachments:
testPic2.JPG [36.93 KiB]
Downloaded 443 times
testPic1.JPG [37.42 KiB]
Downloaded 403 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-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