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.

Why onBar() called 4 times?
 Post subject: Why onBar() called 4 times? Post rating: 0   New post Posted: Mon 02 May, 2011, 14:27 

User rating: 0
Joined: Wed 27 Apr, 2011, 13:56
Posts: 18
I don't understand why onBar() is called 4 times when the bar is closed.

Here is my onBar() method. It simply outputs HIGH of the bar. period is 15 minutes.

public void onBar(Instrument instrument, Period period, IBar askBar,
IBar bidBar) throws JFException {
if (period != this.period) {
return;
}
console.getOut().println("high of the bar: " + bidBar.getHigh());
}

And here is the output of the method:

13:15:01 high of the bar: 81.425
13:15:01 high of the bar: 0.86664
13:15:01 high of the bar: 1.66784
13:15:00 high of the bar: 1.48551

What do all these values mean? The correct one was the last one: 1.48551


 
 Post subject: Re: Why onBar() called 4 times? Post rating: 0   New post Posted: Mon 02 May, 2011, 17:04 

User rating: 0
Joined: Wed 27 Apr, 2011, 13:56
Posts: 18
Sorry,

I've got it. If there are several instruments opened in the workspace the method onBar() will be called for each of them.


 

Jump to:  

  © 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