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.

Supertrend indicator on API
 Post subject: Supertrend indicator on API Post rating: 0   New post Posted: Tue 23 Oct, 2018, 01:51 
User avatar

User rating: 0
Joined: Sun 04 Sep, 2016, 05:22
Posts: 5
Location: AustraliaAustralia
Hi support.
I want to ask, when is going to be released the supertrend indicator on API ?
At the moment is only available to use it on the charts but not to programming / development.
Regards.
Beto


 
 Post subject: Re: Supertrend indicator on API Post rating: 0   New post Posted: Wed 24 Oct, 2018, 12:35 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hello,

It should work:
        int atrPeriod = 20;
        double multiplier = 1.7;
        int shift = 1;
        Object[] supertrendValue = indicators.calculateIndicator(Instrument.EURUSD, Period.ONE_HOUR, new OfferSide[]{OfferSide.ASK, OfferSide.ASK}, "SUPERTREND",
                new IIndicators.AppliedPrice[]{IIndicators.AppliedPrice.CLOSE}, new Object[]{atrPeriod, multiplier}, shift);


You can get the values of any indicator by directly specifying it's name.


 
 Post subject: Re: Supertrend indicator on API Post rating: 0   New post Posted: Fri 02 Nov, 2018, 00:58 
User avatar

User rating: 0
Joined: Sun 04 Sep, 2016, 05:22
Posts: 5
Location: AustraliaAustralia
Hello, please your feedback......

I am using the below code to get the values but I am getting an Exception.
This is happening quite often.
Some times the Exception say (value > Infinite or NaN) and did't present a value.
Some times I am getting the correct values according to the settings.

Below part of the code:

public IFeedDescriptor Feed1 = new TickBarFeedDescriptor(Instrument.EURUSD, TickBarSize.valueOf(100),OfferSide.ASK);
double superTrendValue = Double.NaN;

// OnBar>Method
Object[] spValue = indicators.calculateIndicator(Feed1,
new OfferSide[] { OfferSide.ASK, OfferSide.ASK }, "SUPERTREND",
new AppliedPrice[] { AppliedPrice.CLOSE }, new Object[]{10, 5.0}, 1);

superTrendValue = (Double) spValue[0];

// result

--- superTrendValue = NaN // most of the time I am getting this value
--- superTrendValue = 1.403 // sometimes I got the correct one.

What can be ????


 

Jump to:  

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