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.

onBar
 Post subject: onBar Post rating: 0   New post Posted: Fri 02 Mar, 2012, 14:12 

User rating: 0
Joined: Fri 02 Mar, 2012, 14:06
Posts: 3
Hi,

I'm new to the JForex API. I have a few questions:

(1) IStrategy.onBar. When does this get called? Does it get called whenever a bar closes or does it get continuously called on every tick? If I'm in onBar() and I check the period to be Period.THIRTY_MINS, then does it mean that this is the close of the 30minute bar?

(2) IIndicators. When I do a calculation like indicators.rsi(instrument, Period.THIRTY_MINS, OfferSide.BID, AppliedPrice.CLOSE, 14, 0) in onTick, does it automatically calculate the 30min RSI for the currently incomplete 30min bar? For example, let's say it's 10:15, and I want to calculate 30min RSI in onTick, does it calculate the current RSI value based on the incomplete 30 min bar from 10:00 to 10:15? Or does it calculate it from 9:45 to 10:15?

Thanks!


 
 Post subject: Re: onBar Post rating: 0   New post Posted: Fri 02 Mar, 2012, 16:56 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
realdope wrote:
(1) IStrategy.onBar. When does this get called? Does it get called whenever a bar closes or does it get continuously called on every tick? If I'm in onBar() and I check the period to be Period.THIRTY_MINS, then does it mean that this is the close of the 30minute bar?
It gets executed when a candle stick of a subscribed instrument gets finished, if you want to work only with bars of particular periods, consider bar filtering:
https://www.dukascopy.com/wiki/#Filter_Ticks_Bars
realdope wrote:
(2) IIndicators. When I do a calculation like indicators.rsi(instrument, Period.THIRTY_MINS, OfferSide.BID, AppliedPrice.CLOSE, 14, 0) in onTick, does it automatically calculate the 30min RSI for the currently incomplete 30min bar? For example, let's say it's 10:15, and I want to calculate 30min RSI in onTick, does it calculate the current RSI value based on the incomplete 30 min bar from 10:00 to 10:15?
Yes.
realdope wrote:
Or does it calculate it from 9:45 to 10:15?
No.


 

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