|
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.
Current bar with incorrect time... Why? |
Vitor
|
Post subject: Current bar with incorrect time... Why? |
Post rating: 0
|
Posted: Tue 13 Dec, 2011, 04:25
|
|
User rating: 0
Joined: Tue 13 Dec, 2011, 04:14 Posts: 1 Location: BR
|
Hello,
The code below is retrieving the previous bar, the current bar (being formed) and printing them and the last tick. Notice that the time of the current bar is not right. It should be 2011-12-13 03:00:00.000+0000 (hourly bar start time for the current tick) and not 2011-12-13 08:00:00.000+0000. Am I doing something wrong or is it a bug?
Thanks.
Vitor
public void onTick(Instrument instrument, ITick tick) throws JFException { SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); IBar bar1 = context.getHistory().getBar(instrument, Period.ONE_HOUR, OfferSide.BID, 1); IBar bar0 = context.getHistory().getBar(instrument, Period.ONE_HOUR, OfferSide.BID, 0); System.out.println("bar1: " + bar1); System.out.println("bar0: " + bar0); System.out.println("tick: " + tick); }
output: bar1: 1323741600000[2011-12-13 02:00:00.000+0000] O: 1.3176 C: 1.31877 H: 1.31911 L: 1.31749 V: 6762.13 bar0: 1323763200000[2011-12-13 08:00:00.000+0000] O: 1.31835 C: 1.31835 H: 1.31835 L: 1.31835 V: 0.0 tick: 1323746352055[2011-12-13 03:19:12.055+0000] / 1.31845 / 1.31835
|
|
|
|
 |
API Support
|
Post subject: Re: Current bar with incorrect time... Why? |
Post rating: 0
|
Posted: Tue 13 Dec, 2011, 08:15
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Which instrument are you using?
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|