Dukascopy
 
 
Wiki JStore Search Login

Renko and IRenkoBarFeedListener
 Post subject: Renko and IRenkoBarFeedListener Post rating: 0   New post Posted: Thu 30 Aug, 2012, 12:31 

User rating: 0
Joined: Thu 30 Aug, 2012, 11:59
Posts: 11
Location: AustraliaAustralia
Dear Dukascopy,

I believe that there may be some issues in regards to Renko Bar feeds, namely an 'Out-by-One' error.

When a new bar (ie IRenkoBar) is received by a class (adhering to the IRenkoBarFeedListener interface) that is subsequently subscribed, it is not the most recent bar as it appears on the charts, rather, the SECOND-LAST BAR, probably coming from an "Out-by-One' error.

Please note the following:

In API Version 2.7: BOTH Testing and Demo modes, the 'Out-by-One' error remains in effect.
In API Version 2.6.72: CORRECT Bar in TESTING Mode, INCORRECT Bar in DEMO mode.

It appears that in upgrading from 2.6.72 to 2.7, rather than the Out-By-One Error in Demo Mode being rectified, it has been the other way around in Testing Mode, IE Testing mode has been made incorrect.

IN reference to the 2.7 release notes, the source of this change is likely according to the following:
APICLIENT-192 FIXED Indicator calculation on feed: renko with shift=0 returns result for shift=1

I'm not trading a live account at the moment, so cannot comment on the live comparison.

Regards.


 
 Post subject: Re: Renko and IRenkoBarFeedListener Post rating: 0   New post Posted: Thu 30 Aug, 2012, 13:55 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
ADP wrote:
When a new bar (ie IRenkoBar) is received by a class (adhering to the IRenkoBarFeedListener interface) that is subsequently subscribed, it is not the most recent bar as it appears on the charts, rather, the SECOND-LAST BAR, probably coming from an "Out-by-One' error.
The listener receives a fully completed bar, hence, a new bar on the chart has already started to form. So the bar that you receive in the listener should match the previous one (not the last one) that you see on the chart.


 
 Post subject: Re: Renko and IRenkoBarFeedListener Post rating: 0   New post Posted: Thu 30 Aug, 2012, 14:21 

User rating: 0
Joined: Thu 30 Aug, 2012, 11:59
Posts: 11
Location: AustraliaAustralia
Thanks for your response, however, As I Understand it, the Last Bar on the Chart is Complete, it only appears on the chart once it is made complete and not before.

My interpretation is that the bar passed to the listener is therefore delayed, and so are any indicator calculations.

Please Refer to the attachment.

Regards.


Attachments:
File comment: Schematic & Explanation
Renko_Schematic_30082012.jpg [91.25 KiB]
Downloaded 599 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: Renko and IRenkoBarFeedListener Post rating: 0   New post Posted: Thu 30 Aug, 2012, 14:29 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
ADP wrote:
Thanks for your response, however, As I Understand it, the Last Bar on the Chart is Complete, it only appears on the chart once it is made complete and not before.
This is not the case, follow the instructions in the picture:
Image


Attachments:
renko_with_ohlc.png [32.91 KiB]
Downloaded 779 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: Renko and IRenkoBarFeedListener Post rating: 0   New post Posted: Thu 30 Aug, 2012, 14:59 

User rating: 0
Joined: Thu 30 Aug, 2012, 11:59
Posts: 11
Location: AustraliaAustralia
Thanks, that makes sense, in that case, how can indicators be calculated in the API which incorporate the last bar (still being formed) at the point in time when it appears on the chart?

Cheers.


 
 Post subject: Re: Renko and IRenkoBarFeedListener Post rating: 0   New post Posted: Thu 30 Aug, 2012, 15:25 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
calculation by shift = 0 in the IRenkoBarFeedListener.onBar, will yield the indicator value for the currently forming (i.e. the last) bar.
calculation by shift = 1 in the IRenkoBarFeedListener.onBar, will yield the indicator value for the renko bar that you receive in the listener's parameters (i.e. just finished bar - the previous bar).


 
 Post subject: Re: Renko and IRenkoBarFeedListener Post rating: 0   New post Posted: Sat 01 Sep, 2012, 16:14 

User rating: 0
Joined: Thu 30 Aug, 2012, 11:59
Posts: 11
Location: AustraliaAustralia
Not sure if anyone else is experiencing this, but I'm getting severe negative performance impacts when trying to calculate indicator with shift = 0, vs with shift = 1, for moving averages as an example.

Below is Sample Code....

//Define Variables.
Object               resultPrev,                  //Result for Shift = 1
                        resultNow;                  //Result for Shift = 0
Object[]            indicatorArrayInput;     //Input Parms for Indicator.
OfferSide[]        offerSides;                  //Bid or Ask Offer Side.
AppliedPrice[]    appliedPrices;               //Which Prices to Use as Part of the Calculation
int                   period;                        //Indicator Period
FeedDescriptor descriptor;                   //To Use RENKO Data Input

//Assign Variables.
period                         = 14;
descriptor                   = new FeedDescriptor();
descriptor.setDataType(DataType.RENKO);
descriptor.setOfferSide(OfferSide.BID);
descriptor.setInstrument(Instrument.EURUSD);
descriptor.setPriceRange(PriceRange.valueOf(10));
offerSides                   = new OfferSide[]{OfferSide.BID};
appliedPrices               = new AppliedPrice[]{AppliedPrice.CLOSE};
indicatorArrayInput      = new Object[]{period};

//Calculate Second Last Result Value
resultPrev = indicators.calculateIndicator(descriptor, offerSides,"DEMA",appliedPrices, indicatorArrayInput,1)[0];

//Calculate the Current Value.
resultNow = indicators.calculateIndicator(descriptor, offerSides,"DEMA",appliedPrices, indicatorArrayInput,0)[0];


By negative performance impact, i'm referring to calculation times for shift = 1 and above happens almost instantly (to be expected), however, with shift = 0, there is a considerable delay in obtaining the result.

This is in TESTING Mode.

Regards.


 
 Post subject: Re: Renko and IRenkoBarFeedListener Post rating: 0   New post Posted: Mon 03 Sep, 2012, 17:51 

User rating: 0
Joined: Thu 30 Aug, 2012, 11:59
Posts: 11
Location: AustraliaAustralia
Same Issue with 2.7.2, FYI.


 
 Post subject: Re: APICLIENT-282 Renko and IRenkoBarFeedListener Post rating: 0   New post Posted: Tue 04 Sep, 2012, 13:22 

User rating: 0
Joined: Thu 30 Aug, 2012, 11:59
Posts: 11
Location: AustraliaAustralia
Following on from the code listed a couple of posts ago, the following code-variants may help you to diagnose the problem if you are able to replicate.

long time = bar.getEndTime(); //get the end bar time from the onBar IRenkoBarFeedListener Method.

//This Query Executes Quickly.
Object[] resultFastCalculate = indicators.calculateIndicator(descriptor,offerSides,"DEMA", appliedPrices, indicatorArrayInput,2,time,0);

//This Query Executes Much Slower.
Object[] resultSlowCalculate = indicators.calculateIndicator(descriptor,offerSides, "DEMA", appliedPrices, indicatorArrayInput,1,time,1);


Cheers.


 
 Post subject: Re: APICLIENT-282 Renko and IRenkoBarFeedListener Post rating: 0   New post Posted: Mon 10 Sep, 2012, 09:20 

User rating: 0
Joined: Thu 30 Aug, 2012, 11:59
Posts: 11
Location: AustraliaAustralia
Dear Dukas Support, Would you mind giving some sort of indication as to when the next version will be released with the fix to this issue?


 

Jump to:  

  © 1998-2024 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