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.

Improved getFXSentimentIndex - Add Filtering
 Post subject: Improved getFXSentimentIndex - Add Filtering Post rating: 0   New post Posted: Thu 18 Apr, 2013, 01:51 

User rating: 3
Joined: Thu 17 Nov, 2011, 04:06
Posts: 39
Location: Canada, Ottawa
The current version of getFXSentimentIndex is as follows:
getFXSentimentIndex(Instrument instrument, Period period, long from, long to)

This version returns null values during weekends. An improvement would be to allow filtering, such as:
getFXSentimentIndex(Instrument instrument, Period period, Filter filter, long from, long to)

The following version would also be useful:
getFXSentimentIndex(Instrument instrument, Period period, Filter filter, int numberOfCandlesBefore, long time, int numberOfCandlesAfter)


 
 Post subject: Re: Improved getFXSentimentIndex - Add Filtering Post rating: 0   New post Posted: Thu 18 Apr, 2013, 07:28 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
bradhallett wrote:
This version returns null values during weekends. An improvement would be to allow filtering, such as:
getFXSentimentIndex(Instrument instrument, Period period, Filter filter, long from, long to)

The following version would also be useful:
getFXSentimentIndex(Instrument instrument, Period period, Filter filter, int numberOfCandlesBefore, long time, int numberOfCandlesAfter)
Consider calculating the sentiment index as indicator, see:
https://www.dukascopy.com/wiki/#Sentiment_index/Call_Sentiment_Index_as_indicator
instead of using the from-to calculateIndicator method, use one which uses Filter.


 
 Post subject: Re: Improved getFXSentimentIndex - Add Filtering Post rating: 0   New post Posted: Fri 19 Apr, 2013, 11:32 

User rating: 3
Joined: Thu 17 Nov, 2011, 04:06
Posts: 39
Location: Canada, Ottawa
Is it possible to get the a currency's sentiment (ie. GBP) instead of a symbol via indicator? If so, can you please demonstrate how this is possible?


 
 Post subject: Re: Improved getFXSentimentIndex - Add Filtering Post rating: 0   New post Posted: Fri 19 Apr, 2013, 11:38 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Change SentimentIndexBarIndicator.DataSource in the optional inputs.


 
 Post subject: Re: Improved getFXSentimentIndex - Add Filtering Post rating: 0   New post Posted: Fri 19 Apr, 2013, 11:51 

User rating: 3
Joined: Thu 17 Nov, 2011, 04:06
Posts: 39
Location: Canada, Ottawa
Would this work?

new Object[] { 
            SentimentIndexBarIndicator.SentimentMode.CHART_PERIOD.ordinal(),
            SentimentIndexBarIndicator.DataSource.Currency.getInstance("GBP"),
            SentimentIndexBarIndicator.MAX_BARS_DEFAULT
}


 
 Post subject: Re: Improved getFXSentimentIndex - Add Filtering Post rating: 0   New post Posted: Fri 19 Apr, 2013, 11:56 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
You have to select a value from the SentimentIndexBarIndicator.DataSource enumeration, which you can find in the indicator sources, see:
https://www.dukascopy.com/wiki/#Platform_indicator_source_files


 
 Post subject: Re: Improved getFXSentimentIndex - Add Filtering Post rating: 0   New post Posted: Fri 19 Apr, 2013, 12:16 

User rating: 3
Joined: Thu 17 Nov, 2011, 04:06
Posts: 39
Location: Canada, Ottawa
Based on the Netbeans, it looks like the coding would be:

Object[] values2 = indicators.calculateIndicator(instrument, period, new OfferSide[] { OfferSide.ASK }, "SentimentBar",
        new AppliedPrice[] { IIndicators.AppliedPrice.CLOSE },
        new Object[] {
        SentimentIndexBarIndicator.SentimentMode.CHART_PERIOD.ordinal(),
        SentimentIndexBarIndicator.DataSource.PRIMARY_CURRENCY.ordinal(),
        SentimentIndexBarIndicator.MAX_BARS_DEFAULT
}, from, to);


To get the GBP, I would need to use an instrument such as the GBP/USD.

Is this correct?


 
 Post subject: Re: Improved getFXSentimentIndex - Add Filtering Post rating: 0   New post Posted: Fri 19 Apr, 2013, 12:22 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Test the code and report if any issues.


 

Jump to:  

cron
  © 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