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.

about Period.getUnit()
 Post subject: about Period.getUnit() Post rating: 0   New post Posted: Mon 17 Jan, 2011, 13:28 

User rating: 0
Joined: Sat 06 Nov, 2010, 02:22
Posts: 8
Location: Canada
can anybody show a code example for how to use the method of Period.getUnit()?

getUnit
public final Unit getUnit()Returns time unit. Returns null for TICK

Returns:
time unit


 
 Post subject: Re: about Period.getUnit() Post rating: 0   New post Posted: Tue 18 Jan, 2011, 17:53 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
Consider the following code to use the Period.getUnit() method:
    public void onBar(Instrument instrument, Period period, IBar askbar, IBar bidbar) throws JFException {
       if (instrument.equals(Instrument.EURUSD) &&  period.equals(Period.ONE_HOUR) ) {
          console.getOut().println("Unit: " + period.getUnit());
       }
    }

Please do not hesitate to contact us if you require any further information.


 

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