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.

loading range bars from history
 Post subject: loading range bars from history Post rating: 0   New post Posted: Thu 02 Feb, 2012, 07:43 

User rating: 0
Joined: Tue 22 Nov, 2011, 12:47
Posts: 130
Location: United States,
hi Support,

I'm loading historical bars in stand alone 2.6.53. There is something strange with the range bars time:

Here are the last historical bars:

StartTime: 2012-02-02 01:30:00.0 EndTime: 2012-02-02 01:30:00.1 O: 1.31966 C: 1.31846 H: 1.31966 L: 1.31846 V: 7183.6875 FEC: 1
StartTime: 2012-02-02 01:45:00.0 EndTime: 2012-02-02 03:15:00.0 O: 1.31845 C: 1.3188 H: 1.3188 L: 1.3176 V: 32128.2475 FEC: 7
StartTime: 2012-02-02 03:30:00.0 EndTime: 2012-02-02 04:15:00.0 O: 1.31934 C: 1.31814 H: 1.31934 L: 1.31814 V: 16463.9375 FEC: 4
StartTime: 2012-02-02 04:15:00.1 EndTime: 2012-02-02 04:15:00.2 O: 1.31814 C: 1.31694 H: 1.31814 L: 1.31694 V: 0.0 FEC: 0

Please note that the start and end time are not back to back - there are gaps which doesn't make sense.

After the last historical bar I get the following from a live feed:

StartTime: 2012-02-02 04:30:00.0 EndTime: 2012-02-02 05:59:13.495 O: 1.31607 C: 1.31727 H: 1.31727 L: 1.31607 V: 14344.885 FEC: 1383
StartTime: 2012-02-02 05:59:13.869 EndTime: 2012-02-02 06:27:27.456 O: 1.31729 C: 1.31815 H: 1.31815 L: 1.31695 V: 2117.58 FEC: 1139

Note that there is a gap between the last historical bar and the first live bar of 15 minutes

Also note that the next live bar is ok and is back to back with the previous live bar.

Can you please explain what is the reason for the gaps between consecutive historical bars?

Can you explain if this is correct behavior and if we can use those bars or not?

Please explain why there is a gap between the last historical bar and the first live bar.


For you reference here is the code for loading 100 range bars from historical data:

      List<IRangeBar> historicalRangeBars = null;
      try{
         //get the latest bar
         IBar latestRangeBar = (IBar) context.getHistory().getRangeBar(instrument, offerSide, priceRange , 0);
         //load all bars since then
         historicalRangeBars = context.getHistory().getRangeBars(instrument, offerSide, priceRange, 100, latestRangeBar.getTime(), 0);
         
      }catch (JFException e) {}              


 
 Post subject: Re: loading range bars from history Post rating: 0   New post Posted: Fri 03 Feb, 2012, 09:06 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We tried the example from wiki (https://www.dukascopy.com/wiki/#Feed_history) with JForex-API 2.6.55 and received proper results:
StartTime: 2012-02-03 07:56:57.422 EndTime: 2012-02-03 07:57:11.544 O: 1.31507 C: 1.31493 H: 1.31513 L: 1.31493 V: 29.28 FEC: 17
StartTime: 2012-02-03 07:57:11.989 EndTime: 2012-02-03 07:57:43.888 O: 1.3149 C: 1.31482 H: 1.31502 L: 1.31482 V: 101.65 FEC: 39
StartTime: 2012-02-03 07:57:44.458 EndTime: 2012-02-03 07:58:11.627 O: 1.31481 C: 1.31461 H: 1.31481 L: 1.31461 V: 74.98 FEC: 29
StartTime: 2012-02-03 07:58:12.171 EndTime: 2012-02-03 07:59:02.724 O: 1.31459 C: 1.3147 H: 1.3147 L: 1.3145 V: 97.73 FEC: 44
StartTime: 2012-02-03 07:59:07.946 EndTime: 2012-02-03 07:59:35.579 O: 1.31471 C: 1.31485 H: 1.31485 L: 1.31465 V: 58.24 FEC:
StartTime: 2012-02-03 07:59:36.568 EndTime: 2012-02-03 08:00:02.32 O: 1.31486 C: 1.31467 H: 1.31487 L: 1.31467 V: 59.49 FEC: 23
StartTime: 2012-02-03 08:00:03.302 EndTime: 2012-02-03 08:00:33.993 O: 1.31465 C: 1.31463 H: 1.31483 L: 1.31463 V: 90.17 FEC: 43
StartTime: 2012-02-03 08:00:34.656 EndTime: 2012-02-03 08:00:47.190 O: 1.31456 C: 1.31472 H: 1.31472 L: 1.31452 V: 38.06 FEC: 18
StartTime: 2012-02-03 08:00:47.336 EndTime: 2012-02-03 08:01:04.106 O: 1.31473 C: 1.31461 H: 1.31481 L: 1.31461 V: 53.07 FEC: 23
StartTime: 2012-02-03 08:01:04.463 EndTime: 2012-02-03 08:01:51.629 O: 1.31459 C: 1.31474 H: 1.31474 L: 1.31454 V: 136.15 FEC: 61


 
 Post subject: Re: loading range bars from history Post rating: 0   New post Posted: Fri 03 Feb, 2012, 10:14 

User rating: 0
Joined: Tue 22 Nov, 2011, 12:47
Posts: 130
Location: United States,
hi Support,

It will take me a while to move to the new 2.6.55 API.

Can you please confirm that it is a known bug in 2.6.53 ?


 
 Post subject: Re: loading range bars from history Post rating: 0   New post Posted: Fri 03 Feb, 2012, 10:54 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
cb888trader wrote:
Can you please confirm that it is a known bug in 2.6.53 ?
This is how the range bar history worked before.
Consider using maven project - then your project automatically works with the latest API version, plus it just takes changing one version number in configuration file and rebuilding the project to switch between API versions:
https://www.dukascopy.com/wiki/#Use_with_Maven


 
 Post subject: Re: loading range bars from history Post rating: 0   New post Posted: Fri 03 Feb, 2012, 13:12 

User rating: 0
Joined: Tue 22 Nov, 2011, 12:47
Posts: 130
Location: United States,
Can you please advice what is the corresponding DDS2-jClient-JForex version for 2.6.55 ?


 
 Post subject: Re: loading range bars from history Post rating: 0   New post Posted: Fri 03 Feb, 2012, 13:19 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
2.14.21. But if you work with option <version>[2.14.5,)</version> then the maven will download the latest version as soon as it is there in the public repo - you don't need to follow the DDS2-jClient-JForex version number.


 
 Post subject: Re: loading range bars from history Post rating: 0   New post Posted: Fri 03 Feb, 2012, 13:52 

User rating: 0
Joined: Tue 22 Nov, 2011, 12:47
Posts: 130
Location: United States,
ok -

I changed it from this:

<project>
   <modelVersion>4.0.0</modelVersion>
   <groupId>com.dukascopy.dds2</groupId>
   <artifactId>JForexClientLibrary</artifactId>
   <version>2.14.9</version>


to this:
<project>
   <modelVersion>4.0.0</modelVersion>
   <groupId>com.dukascopy.dds2</groupId>
   <artifactId>JForexClientLibrary</artifactId>
   <version>[2.14.5,)</version>



What now? how do I make it download the latest?

Also - can you please advice how to make my project (which is separated from the maven project) to always reference the latest version? I tried adding a project reference to the maven project but it did not work.


 
 Post subject: Re: loading range bars from history Post rating: 0   New post Posted: Fri 03 Feb, 2012, 14:08 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
No it's the other one that you need to change:
    <dependencies>
        <dependency>
            <groupId>com.dukascopy.dds2</groupId>
            <artifactId>DDS2-jClient-JForex</artifactId>
            <!-- uses latest client version and its dependencies -->
            <version>[2.14.15,)</version>
        </dependency>
   </dependencies>
Actually if you follow the wiki page instructions then you don't need to change anything - just follow the steps described in the article:
https://www.dukascopy.com/wiki/#Use_with_Maven
After you succeed to build the example project, you can either migrate to it your source code or convert your project to maven 2 project. Keep us posted if you encounter any problems.


 
 Post subject: Re: loading range bars from history Post rating: 0   New post Posted: Fri 03 Feb, 2012, 16:11 

User rating: 0
Joined: Tue 22 Nov, 2011, 12:47
Posts: 130
Location: United States,
ok I got it. it is working.

what I do not understand is - when you guys push out a new version, how do I "tell" maven to fetch the most up to date jars ?

just by building the entire project?

do i at least get a message saying that some jars has been updated (just so I know something changed) ?


 
 Post subject: Re: loading range bars from history Post rating: 0   New post Posted: Fri 03 Feb, 2012, 16:59 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
cb888trader wrote:
what I do not understand is - when you guys push out a new version, how do I "tell" maven to fetch the most up to date jars ?
just by building the entire project?
Yes, it downloads the latest jars automatically if you have version interval option (i.e. <version>[1.0,)<\version>), this is done by Maven Incremental Builder. Also you can check what happens if you change the version to a concrete one, for example, changing dependencies\dependency to <version> 2.13.5<\version> and rebuilding the project should make latest functionalities not available - for example, range bar history, indicator calculation on feeds, etc.
cb888trader wrote:
do i at least get a message saying that some jars has been updated (just so I know something changed) ?
If you build the project from console (i.e. mvn install in project directory) then downloading of jars gets logged to console. Please check if you can configure Maven Incremental Builder such that it shows if some new dependencies have got downloaded.


 
 Post subject: Re: loading range bars from history Post rating: 0   New post Posted: Wed 29 Feb, 2012, 07:27 

User rating: 0
Joined: Tue 22 Nov, 2011, 12:47
Posts: 130
Location: United States,
hi support,

I'm trying to load historical range bars with JForex-API-2.6.60 and I'm still getting strange results:

StartTime: 2012-02-28 21:15:00.0 EndTime: 2012-02-28 21:15:00.1 O: 1.34575 C: 1.34695 H: 1.34695 L: 1.34575 V: 2909.375 FEC: 1
StartTime: 2012-02-28 21:30:00.0 EndTime: 2012-02-28 21:30:00.1 O: 1.34708 C: 1.34588 H: 1.34708 L: 1.34588 V: 4364.0625 FEC: 1
StartTime: 2012-02-28 21:45:00.0 EndTime: 2012-02-28 23:15:00.0 O: 1.3458 C: 1.34659 H: 1.34659 L: 1.34539 V: 19165.7175 FEC: 7
StartTime: 2012-02-28 23:30:00.0 EndTime: 2012-02-29 00:15:00.0 O: 1.34795 C: 1.34675 H: 1.34795 L: 1.34675 V: 20219.39 FEC: 4
StartTime: 2012-02-29 00:30:00.0 EndTime: 2012-02-29 02:15:00.0 O: 1.34666 C: 1.34784 H: 1.34784 L: 1.34664 V: 35835.61 FEC: 8
StartTime: 2012-02-29 02:30:00.0 EndTime: 2012-02-29 05:00:00.0 O: 1.34843 C: 1.34852 H: 1.34852 L: 1.34732 V: 42529.95 FEC: 11
StartTime: 2012-02-29 05:15:00.0 EndTime: 2012-02-29 05:15:00.1 O: 1.34853 C: 1.34733 H: 1.34853 L: 1.34733 V: 3914.185 FEC: 1


Can you please explain why there is a gap between the end time of one bar and the start time of the next bar?
Also - the time stamps looks like they are 15 Min bars rather than Range Bars.. Any clue?


 
 Post subject: Re: loading range bars from history Post rating: 0   New post Posted: Wed 29 Feb, 2012, 17:39 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We did not manage to reproduce this, could you please provide the sample strategy and the program that runs it?


 

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