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.

When is onBar() called?
 Post subject: When is onBar() called? Post rating: 0   New post Posted: Fri 10 Dec, 2010, 15:25 

User rating: 0
Joined: Tue 12 Jan, 2010, 02:07
Posts: 5
Hello Dekascopy Support,

In IStrategy, When is onBar() is called in realtime? For example, in realtime, the first tick happens at 02:05:000, then when is the onBar() corresponding to the 60Minute bar ( from 01:00:000 to 01:59:999 ) called? Is it called at 02:00:000 after JForex detects the localtime or server time has passed 02:00:000 or it waits for the first tick of next hour which is five seconds later than 2 O'Clock sharp? If it is the second case, which is called first, onBar() or onTick()?

- Clearpicks


 
 Post subject: Re: When is onBar() called? Post rating: 0   New post Posted: Tue 14 Dec, 2010, 11:34 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
Method onBar() is called when a first tick of the next candle has arrived. If there isn't new ticks, then the onBar() is called after 1 second when the last tick came for the last candle.


 
 Post subject: Re: When is onBar() called? Post rating: 0   New post Posted: Tue 14 Dec, 2010, 15:09 

User rating: 0
Joined: Tue 12 Jan, 2010, 02:07
Posts: 5
Thank you for replying. If the first tick of the next candle arrives at 02:00:001, would onBar() ALWAYS be called before onTick() is called?

Support wrote:
Hi,
Method onBar() is called when a first tick of the next candle has arrived. If there isn't new ticks, then the onBar() is called after 1 second when the last tick came for the last candle.


 
 Post subject: Re: When is onBar() called? Post rating: 0   New post Posted: Wed 15 Dec, 2010, 10:55 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
The order of candles and ticks on the one instrument is guaranteed. That means the bar that logically forms at 02:00:000 will come before the tick at 02.00.001. Between different instruments the order is not guaranteed and onBar with the bar on USD/JPY can be called after tick on EUR/USD that logically should be after that bar.


 

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