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 register a special bar?
 Post subject: How to register a special bar? Post rating: 0   Post Posted: Fri 06 May, 2016, 22:42 
User avatar

User rating: 0
Joined: Mon 11 Apr, 2016, 19:38
Posts: 2
Location: ChinaChina
I can register a specical period callback in OnBar, so which interface I shall call? is it context.subscribeToBarsFeed? If yes, how to set the fourth parameter: listener IBarFeedListener listener?
thanks a log, a sample will be good.


 
 Post subject: Re: How to register a special bar? Post rating: 0   Post Posted: Tue 10 May, 2016, 10:16 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
To process standard chart with specific period please use this:
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
        if(!instrument.equals(Instrument.EURUSD) || !period.equals(Period.ONE_HOUR)) {
            return;
        }
       
        // do the work
    }


If the strategy needs custom feed, renko or range bars for instance, then the strategy needs to subscribe to the custom feed as described here:
https://www.dukascopy.com/wiki/#Chart_f ... _to_a_feed


 

Jump to:  

  © 1998-2026 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