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.

Customizing ZigZag indicator
 Post subject: Customizing ZigZag indicator Post rating: 0   New post Posted: Tue 05 Mar, 2013, 22:37 

User rating: 0
Joined: Tue 05 Mar, 2013, 22:28
Posts: 15
Location: United StatesUnited States
I am new to this forum and the JForex Platform and the JAVA language.
I have an indicator written in EasyLanguage from Tradestation,
and was wondering if you could translate it into JAVA to work in JForex?


 
 Post subject: Re: Indicator code from EasyLanguage Post rating: 0   New post Posted: Wed 06 Mar, 2013, 08:26 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Start here:
https://www.dukascopy.com/wiki/#Create_a_strategy
https://www.dukascopy.com/wiki/#Strategy_API


 
 Post subject: Re: Indicator code from EasyLanguage Post rating: 0   New post Posted: Wed 06 Mar, 2013, 17:55 

User rating: 0
Joined: Tue 05 Mar, 2013, 22:28
Posts: 15
Location: United StatesUnited States
Thanks for the links. I have been looking at the ZigZag indicator code
built into the JForex platform and was wondering if it were possible
to be able to change how the swings are defined. Instead of the
"ExtDepth", "ExtDeviation", and "ExtBackstep", I want to be able to
specify the size of each swinglength by a user-defined
percentage input. For example, when looking at a chart with
the ZigZag indicator on it, I want to know that each swing
shown is at least 0.5 percent big. Is this possible to do?


 
 Post subject: Re: Indicator code from EasyLanguage Post rating: 0   New post Posted: Thu 07 Mar, 2013, 08:38 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
dcaliano wrote:
Is this possible to do?
Yes, find the ZigZag source code here:
https://www.dukascopy.com/wiki/#Platform_indicator_source_files
And instructions for indicator development here:
https://www.dukascopy.com/wiki/#Indicator_API:_Overview


 
 Post subject: Re: Indicator code from EasyLanguage Post rating: 0   New post Posted: Mon 11 Mar, 2013, 04:31 

User rating: 0
Joined: Tue 05 Mar, 2013, 22:28
Posts: 15
Location: United StatesUnited States
I downloaded NetBeans and found the indicator code for ZigZag. (It wasn't easy.) I am unable
to edit the code. (It is all grayed out). Is there something I'm missing? Is there any way you could
give me an idea of where to begin on this code. All the other trading software platforms
I'm used to code the zigzag indicator by percent change. Is there any way you could write the
code and have that as a default option in JForex? I've spent many hours this weekend and
haven't gotten anywhere.


 
 Post subject: Re: Indicator code from EasyLanguage Post rating: 0   New post Posted: Mon 11 Mar, 2013, 09:53 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
dcaliano wrote:
I downloaded NetBeans and found the indicator code for ZigZag. (It wasn't easy.) I am unable
to edit the code. (It is all grayed out). Is there something I'm missing?
Yes, you have to copy it and paste it in your source code package in order to modify it. Also mind to change the indicator name, as you can't register a custom indicator with the same name as the platform indicator.


 
 Post subject: Re: Indicator code from EasyLanguage Post rating: 0   New post Posted: Mon 11 Mar, 2013, 14:56 

User rating: 0
Joined: Tue 05 Mar, 2013, 22:28
Posts: 15
Location: United StatesUnited States
Do I have to create a new project? If so, which kind. I'm getting "no main class" found errors.
Java application under JAVA or MAVEN?


 
 Post subject: Re: Indicator code from EasyLanguage Post rating: 0   New post Posted: Mon 11 Mar, 2013, 15:04 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
See if this tutorial helps you (instead of IStrategy you need IInidicator, but the idea remains the same):
https://www.dukascopy.com/wiki/#Use_in_NetBeans/Create_a_Strategy_in_NetBeans


 
 Post subject: Re: Indicator code from EasyLanguage Post rating: 0   New post Posted: Mon 11 Mar, 2013, 16:07 

User rating: 0
Joined: Tue 05 Mar, 2013, 22:28
Posts: 15
Location: United StatesUnited States
I tried following this. I'm about ready to give up. Is there no easier way?
I get a new project opened, I copy and paste the ZigZag Indicator code
in there, then try to run it and it won't even run without a long list of errors.
And I didn't even attempt changing the code yet!


 
 Post subject: Re: Indicator code from EasyLanguage Post rating: 0   New post Posted: Mon 11 Mar, 2013, 16:33 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please attach the printscreens and error messages that you receive, such that we can assist you on this.


 
 Post subject: Re: Indicator code from EasyLanguage Post rating: 0   New post Posted: Mon 11 Mar, 2013, 19:53 

User rating: 0
Joined: Tue 05 Mar, 2013, 22:28
Posts: 15
Location: United StatesUnited States
I can get this far OK. What do I do next?


Attachments:
File comment: I get this far OK.
NetBeans1.PNG [133.52 KiB]
Downloaded 483 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: Indicator code from EasyLanguage Post rating: 2   New post Posted: Mon 11 Mar, 2013, 23:34 
User avatar

User rating: 94
Joined: Mon 06 Feb, 2012, 12:22
Posts: 357
Location: Portugal, Castelo Branco
Hi dcaliano:

Try with the image sequence i attach below

1 - find source file of zigzag indicator on netbeans, right click and copy
2 - find the package where you want to place the the copied file, righ click on it and paste -> refactor copy
3 - change the name of the indicator to allow to initialize it on other code you want to use the modified indicator
4 - voilá, you have all source code of the indicator working

Hope that helps

Trade well

JL

Image
Image
Image
Image


Attachments:
zigzag2.png [74.78 KiB]
Downloaded 658 times
zigzag3.png [37.42 KiB]
Downloaded 648 times
zigzag4.png [201.4 KiB]
Downloaded 622 times
zigzag1.png [61.75 KiB]
Downloaded 631 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: Customizing ZigZag indicator Post rating: 0   New post Posted: Tue 12 Mar, 2013, 13:34 

User rating: 0
Joined: Tue 05 Mar, 2013, 22:28
Posts: 15
Location: United StatesUnited States
Thanks jlongo for the clear steps. I followed that. When I right click the
new MyTestZigZagIndicator.java, the "run file" is grayed out. Should I be
able to run the file? There are some lightbulbs on some lines.


 
 Post subject: Re: Customizing ZigZag indicator Post rating: 0   New post Posted: Tue 12 Mar, 2013, 13:43 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
dcaliano wrote:
Should I be able to run the file?
You would need to add the main procedure to to this, but normally this is not what you want to do with the indicator. Use it as a custom indicator in the platform, see:
https://www.dukascopy.com/wiki/#Create_an_indicator


 
 Post subject: Re: Customizing ZigZag indicator Post rating: 0   New post Posted: Tue 12 Mar, 2013, 14:08 

User rating: 0
Joined: Tue 05 Mar, 2013, 22:28
Posts: 15
Location: United StatesUnited States
Oh. I see. Thanks API Support.


 
 Post subject: Re: Customizing ZigZag indicator Post rating: 0   New post Posted: Tue 12 Mar, 2013, 18:34 

User rating: 0
Joined: Tue 05 Mar, 2013, 22:28
Posts: 15
Location: United StatesUnited States
 private double extRetracePct = 0.25;

optInputParameterInfos = new OptInputParameterInfo[] {
            new OptInputParameterInfo("extRetracePct", OptInputParameterInfo.Type.PERCENT, new DoubleRangeDescription(extRetracePct, 0.25, 3.5, 0.05))     
        };


This returns "cannot be resolved to a type".

Am I on the right track? How would I define the range boundaries?


 
 Post subject: Re: Customizing ZigZag indicator Post rating: 0   New post Posted: Tue 12 Mar, 2013, 18:45 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
dcaliano wrote:
OptInputParameterInfo.Type.PERCENT
Use OptInputParameterInfo.Type.OTHER.


 
 Post subject: Re: Customizing ZigZag indicator Post rating: 0   New post Posted: Tue 12 Mar, 2013, 18:55 

User rating: 0
Joined: Tue 05 Mar, 2013, 22:28
Posts: 15
Location: United StatesUnited States
Okay. Thanks.
optInputParameterInfos = new OptInputParameterInfo[] {
            new OptInputParameterInfo("extRetracePct", OptInputParameterInfo.Type.OTHER, new DoubleRangeDescription(extRetracePct, 0.25, 3.5, 0.05))     
        };


Here's what I get when trying to compile after doing this:

"The constructor DoubleRangeDescription(double, double, double, double) is undefined.


 
 Post subject: Re: Customizing ZigZag indicator Post rating: 0   New post Posted: Tue 12 Mar, 2013, 18:58 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
You are missing an argument - see:
https://www.dukascopy.com/client/javadoc/com/dukascopy/api/indicators/DoubleRangeDescription.html#DoubleRangeDescription(double,%20double,%20double,%20double,%20int)


 
 Post subject: Re: Customizing ZigZag indicator Post rating: 0   New post Posted: Tue 12 Mar, 2013, 19:09 

User rating: 0
Joined: Tue 05 Mar, 2013, 22:28
Posts: 15
Location: United StatesUnited States
Yes. Now I see. Thanks.


 

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