Dukascopy
 
 
Wiki JStore Search Login

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

    Submit JForex API bug reports in this forum only.
    Submit Converter issues in Converter Issues.
    Off topics are strictly forbidden.

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

Callbacks of onBar method during weekend
 Post subject: Callbacks of onBar method during weekend Post rating: 0   New post Posted: Sun 20 Apr, 2014, 20:23 
User avatar

User rating: 96
Joined: Mon 09 Sep, 2013, 07:09
Posts: 287
Location: Ukraine, SHostka
There is a simple strategy:
package jforex;

import com.dukascopy.api.IAccount;
import com.dukascopy.api.IBar;
import com.dukascopy.api.IContext;
import com.dukascopy.api.IMessage;
import com.dukascopy.api.IStrategy;
import com.dukascopy.api.ITick;
import com.dukascopy.api.Instrument;
import com.dukascopy.api.JFException;
import com.dukascopy.api.Period;
import java.util.EnumSet;

public final class TestWeekendBars implements IStrategy {

    private final Instrument instrument = Instrument.EURUSD;
    private final Period period = Period.ONE_MIN;
    private IContext context;

    public void onStart(IContext context) throws JFException {
        this.context = context;
        context.setSubscribedInstruments(EnumSet.of(instrument), true);
    }

    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
        if (this.instrument == instrument && this.period == period) context.getConsole().getOut().println(askBar);
    }

    public void onTick(Instrument instrument, ITick tick) throws JFException {}
    public void onMessage(IMessage message) throws JFException {}
    public void onAccount(IAccount account) throws JFException {}
    public void onStop() throws JFException {}
}
This strategy was started at 2014-04-20 19:07:25.129 GMT on the remote server and it printed bars:
Image

If the startegy runs locally no bars are printed.


Attachments:
File comment: Strategy Log
weekendbars.png [140.16 KiB]
Downloaded 439 times
TestWeekendBars.java [1.19 KiB]
Downloaded 155 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: Callbacks of onBar method during weekend Post rating: 0   New post Posted: Wed 14 May, 2014, 06:29 
User avatar

User rating: 96
Joined: Mon 09 Sep, 2013, 07:09
Posts: 287
Location: Ukraine, SHostka
Hey, Support,
is anybody here?


 
 Post subject: Re: Callbacks of onBar method during weekend Post rating: 0   New post Posted: Wed 14 May, 2014, 14:03 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
The issue has been registered the same day as it was reported, the problem will get fixed as soon as available.


 
 Post subject: Re: Callbacks of onBar method during weekend Post rating: 0   New post Posted: Mon 08 Dec, 2014, 10:05 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
You can switch off Flat filter on JForex platform (Tools > Preferences > Chart > Flats Filter is disabled) to receive flats on weekends.
Or subscribe in strategy via FeedDescriptor parameter specifying Filter.WEEKENDS to avoid weekend flats on Remote Server.


 

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