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.

How to add an indicator to the chart via API?
 Post subject: How to add an indicator to the chart via API? Post rating: 0   New post Posted: Tue 17 Aug, 2010, 20:17 

User rating: 0
Joined: Wed 18 May, 2011, 11:25
Posts: 60
Location: DE
Hi,

i want to add an indicator to the chart via API and not via the menu of the chart.
a small code snippet would be nice.

i know that IChart has the method addIndicator(IIndicator indicator) but i don't know
how to get or create e.g. the RSI indiactor or VOLUME.

i found out, that the context has some indicators, but they will return the value of it, e.g.
double d = context.getIndicators().rsi(Instrument.EURUSD, Period.ONE_MIN, OfferSide.BID, IIndicators.AppliedPrice.CLOSE, 14, 1);
console.getOut().println("rsi: " + d);


in the api doc, there is a IIndicatorsProvider interface, that has the method getIndicator(String name).
my intension was to use this method e.g. getIndicator("RSI") or getIndicator("VOLUME"). but the problem is,
that i can not found an instance of IIndicatorsProvider to call the method that i want.

so i don't know at the moment how i can add an indicator to the chart.

next thing would be to add an custom indicator to the chart ... but at the moment, i need some help with
a code snippet ;-)


greetings,
tom


 
 Post subject: Re: How to add an indicator to the chart via API? Post rating: 0   New post Posted: Tue 17 Aug, 2010, 20:41 

User rating: 0
Joined: Wed 18 May, 2011, 11:25
Posts: 60
Location: DE
ok i found the method of the IIndicatorsProvider in the getIndicators() too:
context.getChart(Instrument.EURUSD).addIndicator(indicators.getIndicator("RSI"));


and it works. but now i want to change the input parameters, because in this case
for example, the RSI is painted black and i want to paint it in red for example.

i tried the following:
IIndicator rsi = context.getIndicators().getIndicator("RSI");
rsi.setInputParameter(0, Color.BLUE);
context.getChart(Instrument.EURUSD).addIndicator(rsi);


but i got an error:
java.lang.IllegalArgumentException: double[] expected @ jforex.AutoIndicators.onStart(AutoIndicators.java:33)

how can i change the color or other input values like time period for example?


 
 Post subject: Re: How to add an indicator to the chart via API? Post rating: 0   New post Posted: Wed 18 Aug, 2010, 08:49 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Sorry, at the moment this functionality is not available, we will implement it in the near future.


 
 Post subject: Re: How to add an indicator to the chart via API? Post rating: 0   New post Posted: Wed 18 Aug, 2010, 09:20 

User rating: 0
Joined: Wed 18 May, 2011, 11:25
Posts: 60
Location: DE
thx for the answer, i can wait :-)


 
 Post subject: Re: How to add an indicator to the chart via API? Post rating: 0   New post Posted: Tue 31 Aug, 2010, 12:47 

User rating: -
Hi Support.

How can i use pattern indicator?

Source:
https://www.swfx.ch/swiss/english/forex/ ... bad669c8f2


 
 Post subject: Re: How to add an indicator to the chart via API? Post rating: 0   New post Posted: Wed 01 Sep, 2010, 07:56 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
pattern indicators will also be available for use in the near future.


 

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