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.

How to use a strategy with 4H candles EET time?
 Post subject: How to use a strategy with 4H candles EET time? Post rating: 0   New post Posted: Mon 31 Dec, 2018, 16:36 

User rating: 3
Joined: Thu 13 Dec, 2018, 22:09
Posts: 13
Location: GermanyGermany
Hello,

I used Visual JForex to create a strategy which calculates with OHLC of 4H candles.

If I backtest the strategy with the JForex platform, it uses OHLC of 4H candles created by GMT time.
If i set my chart preferences day start time in JForex to EET (UTC + 2), the chart prints 4H candles of EET time. But the backtest still calculates with OHLC of 4H candles created by GMT time.

Is there a solution to tell my strategy to calculate with OHLC of 4H candles created by EET time?

Thanks for your help!


 
 Post subject: Re: How to use a strategy with 4H candles EET time? Post rating: 1   New post Posted: Thu 03 Jan, 2019, 15:07 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hello,

You can create custom period based on your TimeZone and subscribe to it's feed.
    public void onStart(IContext context) throws JFException {
        this.console = context.getConsole();
        this.history = context.getHistory();
        this.context = context;

        Instrument instrument = Instrument.EURUSD;
        OfferSide offerSide = OfferSide.BID;
        Period myPeriod = Period.createCustomPeriod(Unit.Hour, 4, JFTimeZone.EET);
        IFeedListener myFeedListener = new IFeedListener() {
            @Override
            public void onFeedData(IFeedDescriptor feedDescriptor, ITimedData feedData) {
                //your onBar logic
            }
        };
        IFeedDescriptor feedDescriptor = new TimePeriodAggregationFeedDescriptor(instrument, myPeriod, offerSide, Filter.WEEKENDS);

        context.subscribeToFeed(feedDescriptor, myFeedListener);

        IBar myBar = history.getBar(instrument, myPeriod, offerSide, 0);
        console.getOut().println(myBar);
    }


 

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