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.

place stochRSI on chart from strategy
 Post subject: place stochRSI on chart from strategy Post rating: 0   New post Posted: Mon 08 Oct, 2012, 12:37 
User avatar

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

I am very new to the Forex and JForex world so a newbie asks for some help.
I am also not sure if this is the right topic for such question, but after searching around in the forums I haven`t found a better place...

I am trying to place stochRSI on a chart from my strategy. I am trying to use IChart.addIndicator() which I have found in this example:
https://www.dukascopy.com/wiki/#Add_indi ... de_in_OHLC

But I don`t know what parameters do I have to define for the IChart.addIndicator() to make this work.

If I manually add a stochRSI to a chart, I can define 5 things:
Price,
Time period,
Fast K period,
Fast D period,
Fast D MaType,

So I gave it a try to use these:
public int srsiTimePeriod = 14;
public int srsiFastKPeriod = 14;
public int srsiFastDPeriod = 14;
public AppliedPrice appliedPrice = AppliedPrice.CLOSE;

chart.addIndicator(indicators.getIndicator("stochRSI"), new Object [] {srsiTimePeriod, srsiFastKPeriod, srsiFastDPeriod, MaType.EMA});


This compiled, but at start I got:
Unexpected optional parameter [com.dukascopy.api.IIndicators$MaType]=[EMA] for index [3]

Based on https://www.dukascopy.com/wiki/#Indicator_metadata/Retrieve_indicator_metadata the stochRSI has the following metadata:
Output 1: Fast %D - DOUBLE
Output 0: Fast %K - DOUBLE
Opt Input 3: Fast %D MAType - OTHER
Opt Input 2: Fast %D Period - OTHER
Opt Input 1: Fast %K Period - OTHER
Opt Input 0: Time Period - OTHER
Input 0: Price - DOUBLE
Stochastic Relative Strength Indicator: input count=1, optional input count=4, output count=2


What do I miss here?

Thanks in advance.


 
The Best Answer  Post subject: Re: place stochRSI on chart from strategy Post rating: 0   New post Posted: Mon 08 Oct, 2012, 13:29 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
use MaType.EMA.ordinal()


 
 Post subject: Re: place stochRSI on chart from strategy Post rating: 0   New post Posted: Mon 08 Oct, 2012, 14:45 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Thanks for the fast reply.

I will give it a try.

Edit: Saw that the topic move from Automated Trading -> Code Base -> Strategies to here. I had another post in that topic, but that is also gone. Will that appear here as well soon?


 

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