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.

indicators.getIndicator("stoch") - where am I going wrong?
 Post subject: indicators.getIndicator("stoch") - where am I going wrong? Post rating: 0   New post Posted: Tue 04 Dec, 2012, 19:29 
User avatar

User rating: 70
Joined: Sat 22 Sep, 2012, 17:43
Posts: 118
Location: Brazil, Fortaleza, Ceará
Trying to get stoch 14,3,5:
Attachment:
scr2.png [13.9 KiB]
Downloaded 484 times

but get:
Attachment:
scr1.png [13.52 KiB]
Downloaded 461 times

even flipping the 14 and 3 around gives me nothing but the default 5,3,3


 
 Post subject: Re: indicators.getIndicator("stoch") - where am I going wrong? Post rating: 0   New post Posted: Tue 04 Dec, 2012, 20:35 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
please provide full example strategy, please describe more precisely what results you expect and what they actually are.


 
 Post subject: Re: indicators.getIndicator("stoch") - where am I going wrong? Post rating: 0   New post Posted: Wed 05 Dec, 2012, 18:57 
User avatar

User rating: 70
Joined: Sat 22 Sep, 2012, 17:43
Posts: 118
Location: Brazil, Fortaleza, Ceará
Please only confirm that you SHOULD or SHOULD NOT be able to (from any strategy you have there) obtain 14,3,5 (second screen shot shows I only get the defaults) by issuing the above optional input settings (first screen shot) on your own "stoch" indicator on API v2.7.5.

I have solved this at my end by trying:

i.setOptInputParameter(0, 14);
i.setOptInputParameter(1, 3);
i.setOptInputParameter(2, 0);
i.setOptInputParameter(3, 5);
i.setOptInputParameter(4, 0);
ct.add(i)


then trying:

ct.add(i)
i.setOptInputParameter(0, 14);
i.setOptInputParameter(1, 3);
i.setOptInputParameter(2, 0);
i.setOptInputParameter(3, 5);
i.setOptInputParameter(4, 0);


and eventually winning with:

ct.add(i, new Object[]{14,3,0,5,0}); <------


 
 Post subject: Re: indicators.getIndicator("stoch") - where am I going wrong? Post rating: 0   New post Posted: Thu 06 Dec, 2012, 08:46 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
CriticalSection wrote:
Please only confirm that you SHOULD or SHOULD NOT be able to (from any strategy you have there) obtain 14,3,5 (second screen shot shows I only get the defaults) by issuing the above optional input settings (first screen shot) on your own "stoch" indicator on API v2.7.5.
Without full example strategy we can't precisely imply what you mean.


 
 Post subject: Re: indicators.getIndicator("stoch") - where am I going wrong? Post rating: 0   New post Posted: Tue 18 Dec, 2012, 18:13 
User avatar

User rating: 70
Joined: Sat 22 Sep, 2012, 17:43
Posts: 118
Location: Brazil, Fortaleza, Ceará
Just in case anyone reads this thread and needs conclusion, the issue above is simply that

i.setOptInputParameter() is not for calling by us but it's called by the indicator subsystem.

so using IChart add(indicator, array) e.g. ct.add(i, new Object[]{14,3,0,5,0}) is the way you

add indicators and set their optional parameters.

If you try to call i.setOptInputParameter() then IChart add(indicator, array)

the parameters are overridden by the ones provided in the array.

If you try to call i.setOptInputParameter() then IChart add(indicator) what
you set is overridden by the defaults (i.e. ignored).


 

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