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.

Bollinger Band values different on chart and strategy
 Post subject: Bollinger Band values different on chart and strategy Post rating: 0   New post Posted: Tue 04 Nov, 2014, 22:41 

User rating: 0
Joined: Fri 31 Oct, 2014, 23:47
Posts: 3
Location: HungaryHungary
I use this for calculating Bollinger bands:

        Period eetDaily = Period.createCustomPeriod(Unit.Day, 1, JFTimeZone.EET);
        this.dailyFeedDesc = new TimePeriodAggregationFeedDescriptor(myInstrument, eetDaily, OfferSide.BID, Filter.ALL_FLATS);

...

        Object[] bb1_2 = this.indicator.calculateIndicator(dailyFeedDesc, new OfferSide[]{OfferSide.BID}, "BBANDS",
                new IIndicators.AppliedPrice[]{IIndicators.AppliedPrice.CLOSE},
                new Object[]{20, 1.0, 1.0, IIndicators.MaType.SMA.ordinal()}, 3);

        double middleValue2 = (double) bb1_2[1];


My platform and chart is set up accordingly, but the values are a bit different. For example (middle line value):
-right value (on chart): 1.01193 (I calculated it manually too)
-wrong value (strategy): 1.00943

The candlesticks are all the same on chart and the strategy, I have checked it.

I also checked this page: https://www.dukascopy.com/wiki/#Indicato ... _checklist

Has anybody any idea why this can happen?

Thank you


 
 Post subject: Re: Bollinger Band values different on chart and strategy Post rating: 0   New post Posted: Thu 06 Nov, 2014, 14:46 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Hi,

As always, it is easier to see/check/test what is going on, if you attach a sample strategy that replicates the case.

I don't know if the BBand indicator using unstable period, but if it is, that might be the reason for the slight difference.
Take a look on this topic where we talk about the unstable periods in general, and how it is affecting indicator calculation.

IndicatorInfo can be use to check if an indicator is using unstable periods. You can start with that.


 
 Post subject: Re: Bollinger Band values different on chart and strategy Post rating: 0   New post Posted: Fri 07 Nov, 2014, 09:14 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We were unable to reproduce this problem. It could be helpful if you provided full example strategy.
1) Please check that you have set correct date start time:
Image

2) Note that BBANDS default parameters are (20, 2,2, EMA) but strategy uses (20, 1, 1, SMA)
3) Also make sure filter ALL_FLATS is selected in settings.


Attachments:
Fullscreen capture 1172014 100908 AM.jpg [106.82 KiB]
Downloaded 186 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.
 

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