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.

bbands problem
 Post subject: bbands problem Post rating: 0   New post Posted: Fri 11 Jan, 2013, 03:07 

User rating: 0
Joined: Fri 16 Nov, 2012, 16:36
Posts: 11
hi.

in my strategy, l create a bbands :

       AppliedPrice appliedPrice = AppliedPrice.CLOSE;
     
        // Incrémentation des Indicateurs
        double Kama = indicators.kama(instrument, Period.FIFTEEN_MINS,OfferSide.ASK, appliedPrice, 20, 2,30,5);
       
        // Bande de Bollinger
        MaType maType = MaType.SMA;
        double BB[] = indicators.bbands(instrument, Period.FOUR_HOURS, OfferSide.ASK, appliedPrice, 20, 2, 2, maType, 1);


(sorry for my bad english, i speak french)

but, when i check the vallue of de BB[1] , its give me a value of Bollinger Bands with a timeperiod 6 or 7 (but not the data of a bbands with timeperiod of 20 lol)
i manually adds bbands indicators on the chart(Four Hours) with the setting 20,2,2,1 with MaType SMA and i really dont have the same value

i check the value of BB[1] with that :
        for (IChart chart : this.context.getCharts(instrument)) {
            chart.setCommentFont(font);
            chart.setCommentColor(Color.GRAY);
            chart.comment("Bande de Bollinger : " + BB[1]);
        }


i try with indicators.sma(...) and i have a the same problem with the data

* I have the right data for the Kama


 
 Post subject: Re: bbands problem Post rating: 0   New post Posted: Fri 11 Jan, 2013, 08:40 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please go through:
https://www.dukascopy.com/wiki/#Indicator_usage_checklist
For chart-to-strategy value comparsions consider the following approach:
https://www.dukascopy.com/wiki/#Add_indicators_on_chart/Include_in_OHLC


 
 Post subject: Re: bbands problem Post rating: 0   New post Posted: Fri 11 Jan, 2013, 16:02 

User rating: 0
Joined: Fri 16 Nov, 2012, 16:36
Posts: 11
Ok!
Thanks for fast reply!

Reply me if what i say is wrong plz

If i understand what did you say, i must plot indicators Kama on chart and add this in OHLC
and i suppose to make a function "Plot on newly opened chart" (for the Bollinger Bands in Four Hours) and add it in the OHLC too?


In the final result, i have 2 chart opened and 1 indicators each chart, and the code will working?
I suppose i dont delete this part of code
        double Kama = indicators.kama(instrument, Period.FIFTEEN_MINS,OfferSide.BID, appliedPrice, 20, 2,30,5);
       
        // Bande de Bollinger
        MaType maType = MaType.SMA;
        double BB[] = indicators.bbands(instrument, Period.FOUR_HOURS, OfferSide.BID, appliedPrice, 20, 2, 2, maType, 1);



Normally if i add indicators on chart, it is just a visual utility? Because if i dont plot indicators on each chart, i just want know if i can only create function to open a four hours chart and it's working?

Sorry, i'm just a beginner for creating strategy lol!

Thanks you


 
 Post subject: Re: bbands problem Post rating: 0   New post Posted: Fri 11 Jan, 2013, 16:57 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
JaYQC12 wrote:
If i understand what did you say, i must plot indicators Kama on chart and add this in OHLC
and i suppose to make a function "Plot on newly opened chart" (for the Bollinger Bands in Four Hours) and add it in the OHLC too?
This our suggestion for more convenient chart-to-strategy indicator value comparison. Which example to use is up to you - whichever helps you understand where the problem lies.


 
 Post subject: Re: bbands problem Post rating: 0   New post Posted: Fri 11 Jan, 2013, 17:20 

User rating: 0
Joined: Fri 16 Nov, 2012, 16:36
Posts: 11
AH OK!!

Forget the last post lol!

I understand. I had found my problem, it's juste a bad filter choice.

Thanks.


 

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