|
JFOREX-3350 API returns wrong bars and indicator values |
RoadRunner
|
Post subject: JFOREX-3350 API returns wrong bars and indicator values |
Post rating: 0
|
Posted: Mon 28 Nov, 2011, 18:17
|
|
User rating: 3
Joined: Wed 18 May, 2011, 16:25 Posts: 331 Location: SwitzerlandSwitzerland
|
Dear support,
the following example shows that sometimes the current bar is not properly loaded by history.getBars when calling getBars at the first tick of the new bar. In these instances the returned bars are falsely shifted by 1 period and so are ALL indicator-values!
Example: EUR/USD, tick.getTime() = Tue 2011.01.11 01:39:20.032 history.getStartTimeOfCurrentBar(Instrument.EURUSD, Period.TEN_SECS) = Tue 2011.01.11 01:39:20.000 -> which is correct.
history.getBars(Instrument.EURUSD,Period.TEN_SECS,OfferSideBID,Filter.ALL_FLATS,3,history.getStartTimeOfCurrentBar(Instrument.EURUSD, Period.TEN_SECS),0)
[1294709910000[2011-01-11 01:38:30.000+0000] O: 1.29169 C: 1.29179 H: 1.29186 L: 1.29169 V: 38.85, 1294709920000[2011-01-11 01:38:40.000+0000] O: 1.29179 C: 1.29169 H: 1.29179 L: 1.29169 V: 14.45, 1294709950000[2011-01-11 01:39:10.000+0000] O: 1.2917 C: 1.29174 H: 1.29176 L: 1.2917 V: 8.64]
The last bar returned is not the current bar, but the previous bar. The correct bars to return would be 01:38:40.000, 01:39:10.000 and 01:39:20.000 (current c/s).
Best, RR.
|
|
|
|
 |
API Support
|
Post subject: Re: JFOREX-3350 API returns wrong bars and indicator values |
Post rating: 0
|
Posted: Thu 08 Dec, 2011, 11:31
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Please provide us with an example of your strategy. Namely, when
"history.getStartTimeOfCurrentBar(Instrument.EURUSD, Period.TEN_SECS) = Tue 2011.01.11 01:39:20.000 -> which is correct." "history.getBars(Instrument.EURUSD,Period.TEN_SECS,OfferSideBID,Filter.ALL_FLATS,3,history.getStartTimeOfCurrentBar(Instrument.EURUSD, Period.TEN_SECS),0) "
are invoked.
Please try the following (use exactly the same "currentBarStartTime" as a parameter to the "history.getBars" method):
long currentBarStartTime = history.getStartTimeOfCurrentBar(Instrument.EURUSD, Period.TEN_SECS) ; history.getBars(Instrument.EURUSD,Period.TEN_SECS,OfferSideBID,Filter.ALL_FLATS,3,currentBarStartTime,0) .
This will save from last (current) bar time's parameter inconsistency.
We have attached a test strategy which must reveal described problem if any.
Attachments: |
TestHistoryBarsStrategy.java [4.46 KiB]
Downloaded 409 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
 |
RoadRunner
|
Post subject: Re: JFOREX-3350 API returns wrong bars and indicator values |
Post rating: 0
|
Posted: Thu 08 Dec, 2011, 16:56
|
|
User rating: 3
Joined: Wed 18 May, 2011, 16:25 Posts: 331 Location: SwitzerlandSwitzerland
|
Dear support,
thanks a lot for looking into this issue. I did run your testcode and it logs quite a few inconsistencies. Please find the zipped message log for the run for 2011-01-11 attached.
Kind regards, RR.
Attachments: |
TestHistoryBarsStrategy_tester-messages for 2011-01-11.zip [48.68 KiB]
Downloaded 346 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
 |
API Support
|
Post subject: Re: JFOREX-3350 API returns wrong bars and indicator values |
Post rating: 0
|
Posted: Fri 09 Dec, 2011, 14:31
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
As far as we see you use a historical tester to check your strategy. It seems you specified an ALL_FLATS filter in the history.getBars.
It's highly probable that the last ("current") bar was a flat. It seemed to be skipped and had not been returned by "getBars" method. The result list contained some previous non-flat bars only. The attached "TestHistoryBarsStrategy.java" strategy is intended to analyse inconsistency in the live data only.
In addition, we have changed TesterHistory class to skip corresponding "flats" candles if some flat filter is specified. It will be available in API 2.6.51.
|
|
|
|
 |
RoadRunner
|
Post subject: Re: JFOREX-3350 API returns wrong bars and indicator values |
Post rating: 0
|
Posted: Sun 11 Dec, 2011, 19:09
|
|
User rating: 3
Joined: Wed 18 May, 2011, 16:25 Posts: 331 Location: SwitzerlandSwitzerland
|
Dear support, thank you for your reply. Quote: As far as we see you use a historical tester to check your strategy. It seems you specified an ALL_FLATS filter in the history.getBars. That's correct. Quote: It's highly probable that the last ("current") bar was a flat. It seemed to be skipped and had not been returned by "getBars" method. Yes, this sound plausible. IMO, it would be better, if the currently forming bars would NEVER be filtered for flats. Only after the first tick is generated, it is known that the bar is not flat. The first tick of the bar could ultimately happen to be on the last millisecond of the bar period. It would be preferrable, if the current bar would always be shown. Thanks a lot for considering. Quote: In addition, we have changed TesterHistory class to skip corresponding "flats" candles if some flat filter is specified. It will be available in API 2.6.51. I'm not quite sure if I understand. At the moment, the flats are already filtered. What will be changed in 2.6.51? Thanks & best, RR.
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|