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.

getting the current bar in Range Bars
 Post subject: getting the current bar in Range Bars Post rating: 0   New post Posted: Fri 25 Nov, 2011, 05:40 

User rating: 0
Joined: Tue 22 Nov, 2011, 12:47
Posts: 130
Location: United States,
hi,

another newbie question -

I'm trying to get hold of the current bar while in onTick method in Range Bars.

I tried:

history.getBar(chart.getInstrument(), ???period???, chart.getSelectedOfferSide(), 0)


what should I put in period? The class Period has only time based pre-defined values.

As a workaround I'm keeping a reference to the current bar (in the onBar method).

thanks!
cb888trader.


 
 Post subject: Re: getting the current bar in Range Bars Post rating: 0   New post Posted: Fri 25 Nov, 2011, 09:03 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
If you need the period of chart, then consider using chart.getSelectedPeriod().


 
 Post subject: Re: getting the current bar in Range Bars Post rating: 0   New post Posted: Fri 25 Nov, 2011, 12:05 

User rating: 0
Joined: Tue 22 Nov, 2011, 12:47
Posts: 130
Location: United States,
yes - I need the period of the chart but it is a Range Bar chart.

When I tries this:

chart.getSelectedPeriod().getNumOfUnits()


I'm getting the value -1 instead of the actual pips range for that range bar period. So How to get the number of pips for the Range Bar?


 
 Post subject: Re: getting the current bar in Range Bars Post rating: 0   New post Posted: Fri 25 Nov, 2011, 18:09 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Range bar history is available with JForex-API 2.6.49 (available in Standalone API ). In JForex Client (which uses version 2.6.38) you have to keep track on range bar values yourself.


 

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