|
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.
NullPointer generated by history.getTickBars method on new tickBar |
iulian
|
Post subject: NullPointer generated by history.getTickBars method on new tickBar |
Post rating: 0
|
Posted: Thu 03 Jan, 2013, 21:23
|
|
User rating: 1
Joined: Wed 06 Jul, 2011, 23:12 Posts: 42 Location: Romania, Bucharest
|
Dear Sirs,
I wrote a code to extract a list of 10 ticks bars starting with the last one. For that I used the following sequence:
ITickBar lastBar10t = history.getTickBar(selectedInstrument, offerSide, TickBarSize.valueOf(10), 0); List<ITickBar> Bars10t = history.getTickBars(selectedInstrument, offerSide, TickBarSize.valueOf(10), 30, lastBar10t.getEndTime(), 0);
Every times a new 10 ticks bar is started the above sequence generates a NullPointerException error and I believe that this in happening because the history.getTickBar method returns null on every new tickBar start.
Thank your very much in advance! Iulian
|
|
|
|
 |
API Support
|
 |
Post subject: Re: NullPointer generated by history.getTickBars method on new tickBar |
Post rating: 0
|
Posted: Fri 04 Jan, 2013, 13:38
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
The method history.getTickBar(..., 0) can return null in ITickBarFeedListener.onBar(...) (in other words on every new tickBar start) if there is no any in-progress tick bar at this moment yet. For example, we have 10T tick bars. The current in-progress tick bar contains 9 ticks. Another tick just has arrived to the system. This event will cause current in-progress tick bar accomplishing and listener onBar(...) notification. So, in this moment, there is no yet the next tick, which could start the next in-progress tick bar. Therefore history.getTickBar(..., 0) returns null in such moment in onBar(...) listener. The method history.getTickBar(..., 0) could not return this fully constructed tick bar, because it's not in-progress any more. Please use a bar passed to listener to detect the end time.
|
|
|
|
 |
iulian
|
Post subject: Re: NullPointer generated by history.getTickBars method on new tickBar |
Post rating: 0
|
Posted: Fri 04 Jan, 2013, 14:58
|
|
User rating: 1
Joined: Wed 06 Jul, 2011, 23:12 Posts: 42 Location: Romania, Bucharest
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|