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.

IHistory.getRangeBars are wrong with 15 pips range bars!
 Post subject: IHistory.getRangeBars are wrong with 15 pips range bars! Post rating: 0   New post Posted: Sun 01 Apr, 2012, 12:06 
User avatar

User rating: 21
Joined: Thu 19 May, 2011, 20:50
Posts: 413
Location: Germany, Munich
I used support's sample program RangeBarsMinMaxIndicator2.java mentioned in thread viewtopic.php?f=65&t=44000&p=57676&hilit=range+bar#p57676 .
I tested it with 15 pips range bars and pricerange = 5 and the output was the following

2012-04-01 10:58:02 StartTime: 2012-03-25 21:00:00.0 EndTime: 2012-03-25 22:15:00.0 O: 1.32705 C: 1.32803 H: 1.32803 L: 1.32643 V: 4254.975 FEC: 6
2012-04-01 10:58:02 StartTime: 2012-03-23 15:30:00.0 EndTime: 2012-03-25 20:45:00.0 O: 1.3262 C: 1.32684 H: 1.32717 L: 1.32568 V: 109800.17 FEC: 214
2012-04-01 10:58:02 StartTime: 2012-03-23 14:30:00.0 EndTime: 2012-03-23 15:15:00.0 O: 1.32798 C: 1.32673 H: 1.32833 L: 1.32673 V: 45078.74 FEC: 4
2012-04-01 10:58:02 StartTime: 2012-03-23 14:15:00.4 EndTime: 2012-03-23 14:15:00.5 O: 1.32525 C: 1.32685 H: 1.32685 L: 1.32525 V: 0.0 FEC: 0
2012-04-01 10:58:02 StartTime: 2012-03-23 14:15:00.2 EndTime: 2012-03-23 14:15:00.3 O: 1.32365 C: 1.32525 H: 1.32525 L: 1.32365 V: 0.0 FEC: 0

Why is the StartTime and EndTime exactly on a quarter of an hour?
This looks like a bug. If you take 10 pips range bars it looks ok.
Please correct this asap.

Bug approved with JForex DEMO version
Dukascopy ver. 2.15
JForex API ver. 2.6.63


Attachments:
RangeBarsMinMaxIndicator2.java [3.23 KiB]
Downloaded 370 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.
 
 Post subject: Re: JFOREX-3674 IHistory.getRangeBars are wrong with 15 pips range bars! Post rating: 0   New post Posted: Mon 02 Apr, 2012, 14:35 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Range bars are being generated from ticks. However, it's almost impossible to generate range bars with bigger price range value from ticks due to there are too much of them.
The system will operate too slow.
So, for bigger price ranges we take candles, split them into ticks and generate range bars.

For 15 pips range bars, we take 1 hour candles. The procedure of range bars generation from candles is as follows:
We take target candle and split it into 4 ticks with four prices (open, high, low, close) and with 0.25 of candle's volume each.
Thus we will get 4 ticks (for one hour candle with time let's say 13:00 ) with times 13:00, 13:15, 13:30 and 13:45. Those ticks we will use to create range bars.

Due to those ticks have not real times (13:00, 13:15, 13:30 and 13:40) range bars have them too.
Note, that this algorithm is used only for history generation, in-progress range bars are being generated from real ticks.


 
 Post subject: Re: IHistory.getRangeBars are wrong with 15 pips range bars! Post rating: 0   New post Posted: Mon 02 Apr, 2012, 20:46 
User avatar

User rating: 21
Joined: Thu 19 May, 2011, 20:50
Posts: 413
Location: Germany, Munich
1) This is also the reason why indicator functions get imprecise in the History Tester, isn't it?

2)
Quote:
So, for bigger price ranges we take candles, split them into ticks and generate range bars
From what range bar size do you start this process?


 
 Post subject: Re: IHistory.getRangeBars are wrong with 15 pips range bars! Post rating: 0   New post Posted: Tue 03 Apr, 2012, 12:11 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
1) Yes it is, but only for those price ranges, which history is generated from candles.
2) Now we use the next method to get a suitable period for the passed pips count:
public static Period getSuitablePeriod(int pipsCount) { 
    if (pipsCount <= 2) {
        return Period.TICK;
    }
    else if (pipsCount <= 10) {
        return Period.ONE_MIN;
    }
    else {
        return Period.ONE_HOUR;
    }
}


 

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