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.

help about getbars;
 Post subject: help about getbars; Post rating: 0   New post Posted: Mon 12 Mar, 2018, 08:47 

User rating: 0
Joined: Mon 11 Dec, 2017, 03:30
Posts: 26
Location: China,
here i want to readbars (spec time internal, for example readbars 2018:03::01:01:10-2018:3:01:12:10 Period.TEN_MINS BARS)

CODE
.......

GetSpecTimeBars(Instrument.EURUSD, Period.TEN_MINS, OfferSide.BID, time, 1, 0, 18, 0);
...............

private List GetSpecTimeBars(Instrument SpecInstrument,Period SpecPeriod, OfferSide ofside, long TodayTime,int fromHour,int fromMin,int toHour,int toMin) throws JFException{
}

but show is:

com.dukascopy.api.JFException: Interval from [2018.03.12 01:00:00 000] to [2018.03.12 07:24:47 554] GMT is not valid for period [10 Mins]
at com.dukascopy.api.impl.o.b(L:1363)
at com.dukascopy.api.impl.o.getBars(L:727)
at jforex.SmaFlipMinMax.GetSpecTimeBars(SmaFlipMinMax.java:103)
at jforex.SmaFlipMinMax.onStart(SmaFlipMinMax.java:52)
at com.dukascopy.api.impl.execution.s.call(L:27)
at com.dukascopy.api.impl.execution.s.call(L:13)
at com.dukascopy.api.impl.connect.au.a(L:140)
at com.dukascopy.api.impl.connect.cn.call(L:713)
at com.dukascopy.api.impl.connect.cn.call(L:674)
at com.dukascopy.api.impl.execution.j.call(L:34)
at java.util.concurrent.FutureTask.run(Unknown Source)
at com.dukascopy.api.impl.execution.f$a.e(L:904)
at com.dukascopy.api.impl.execution.f$a.run(L:926)
at java.lang.Thread.run(Unknown Source)


 
 Post subject: Re: help about getbars; Post rating: 0   New post Posted: Tue 13 Mar, 2018, 10:02 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
This happens because getBars assumes that from and to times are equal to 10 min bar start time. This means that from and to times should be normalized using history.getBarStart(Period period, long time method.
https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/IHistory.html#getBarStart-com.dukascopy.api.Period-long-


 

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