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.

custom indicator in strategy
 Post subject: custom indicator in strategy Post rating: 0   New post Posted: Thu 22 Nov, 2012, 13:32 

User rating: 1
Joined: Mon 27 Feb, 2012, 22:49
Posts: 119
Location: Czech Republic,
I’d like to picture some values from my strategy in desktop JForex chart like as an indicator (RSI, ..).
I can open chart and add Dukascopy indicator (IChartPanel rmiPanel = Chart.add( indicators.getIndicator("RMI"), new Object[]{15, 1}); )

But if I take source code RMI indicator (from SDK) and put it into my strategy as a class ÏndicatorRMI, I can NOT add this indicator to chart.
I use this code:
IndicatorRMI ind = new IndicatorRMI();
IChartPanel indPanel = Chart.add( ind, new Object[]{ 15, 1 } );
I receive NullPointerException. But both objects are not null. I tried it on live account. On demo it doesn't work too.
It is very important for me.
Could you advise me?

Thanks very much.


 
 Post subject: Re: custom indicator in strategy Post rating: 0   New post Posted: Thu 22 Nov, 2012, 16:44 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please provide both the indicator and the example program that is plotting it on the chart.


 
 Post subject: Re: custom indicator in strategy Post rating: 0   New post Posted: Thu 22 Nov, 2012, 19:58 

User rating: 1
Joined: Mon 27 Feb, 2012, 22:49
Posts: 119
Location: Czech Republic,
Here is example code for testing. I have tested it this afternoon only on demo account. Live account was not accessible.


Attachments:
CheckChartAddInd.java [8.1 KiB]
Downloaded 302 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: custom indicator in strategy Post rating: 0   New post Posted: Fri 23 Nov, 2012, 08:23 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
You need to open the chart first, before you can plot an indicator on it, see:
https://www.dukascopy.com/wiki/#JForex_SDK/Open_a_chart_from_IClient
Should you have any further problems, please provide also the program which runs the strategy in JForex-SDK.


 
 Post subject: Re: custom indicator in strategy Post rating: 0   New post Posted: Fri 23 Nov, 2012, 11:08 

User rating: 1
Joined: Mon 27 Feb, 2012, 22:49
Posts: 119
Location: Czech Republic,
I don't understand. Strategy opens chart. I see it.You can check it too.

Links solve chart open for standalone API and don't solve adding indicator. It implements IClient.

My strategy is not standalone. I run it under JForex desktop. I implement IStrategy direct.


 
 Post subject: Re: custom indicator in strategy Post rating: 0   New post Posted: Fri 23 Nov, 2012, 11:53 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Your approach won't work, because you need to register your indicator, before you can use it, see:
https://www.dukascopy.com/wiki/#Use_cust ... strategies
Also note, that the indicator name needs to be unique (i.e. it also can't match with any platform indicator name).


 
 Post subject: Re: custom indicator in strategy Post rating: 0   New post Posted: Fri 23 Nov, 2012, 13:09 

User rating: 1
Joined: Mon 27 Feb, 2012, 22:49
Posts: 119
Location: Czech Republic,
But registration get JFException: Cannot create indicator...


Attachments:
CheckChartAddInd.java [8.44 KiB]
Downloaded 313 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: custom indicator in strategy Post rating: 0   New post Posted: Fri 23 Nov, 2012, 14:11 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
The indicator has to be an inner public static class, as it is given in the example under the above given link.


 
 Post subject: Re: custom indicator in strategy Post rating: 0   New post Posted: Fri 23 Nov, 2012, 14:41 

User rating: 1
Joined: Mon 27 Feb, 2012, 22:49
Posts: 119
Location: Czech Republic,
Now it works. Thanks very much. Have a nice weekend.


 

Jump to:  

  © 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