Archive for August, 2009

26
Aug
09

How open strategy in Dukascopy JForex platform

First of all you need login into JForex platform using your username and password.
Strategies management tree located in ‘Workspace‘ panel which usually placed in left lower corner.
You should see leafs ‘Currencies‘, ‘Strategies‘ and ‘Charts‘. ‘Strategies‘ – this is what we looking for.

Lets say, you have code of your strategy opened somewhere in text editor from where you can simple copy and paste him.

Do right click on ‘Strategies‘ leaf and select ‘New Strategy‘ item.
JForex platform will open new editor window with some initial strategy template.
This template is useful when you need start development but as long we already have code we can dont heed him.
Clear edit area by deleting template.
Copy all code of your strategy into buffer(hint: to select all use hot key Ctrl+A) and paste him into JForex Platform editing area.

Once you did this save the strategy pressing ‘Save‘ button or using hot key ‘Ctrl+S’.
Name of your file should be the same as name of main class of your strategy.
You can get this name looking in the beginning for the code where you should find something like this:

 public class MyGreatStrategy implements IStrategy {
 ....

In this example you need save file under name MyGreatStrategy.java.

Another way add your strategy in platform is open saved file from hard drive.
To to this select ‘Open Strategy‘ from menu and find file with code.

Now lets check is our code bug free and at least can be compiled.
To do this right click on ‘MyGreatStrategy‘ and select ‘Compile‘.
Doing that you will transform your strategy in binary form acceptable for execution of JForex Platform and in same time do code verification for syntax errors.
Depends on size of strategy compilation may take some time.
Results(good or bad) you able to monitor in ‘Messages‘ tab which will change color of title once process is finished.

Imagine that we are leaving in ideal world and everything was ok this time.
From that point we have 2 directions – do historical testing(‘Test‘) to verify logic or go trading(‘Run‘).
In most of the cases we suggest test what you have before trading.
Yes, historical tester not cover full picture and sometimes his results far from the real market situation but he can show is behaviour of your strategy is meet your expectations.

Sometimes you need external libraries which was supplied with strategy code.
In our example additionally to standard Java classes we use extra libraries: axonsoftware-jforex-utils.jar and spread.jar

To include this files in compilation you need provide full path to them in special tag @Library separated by ‘;’ e.g.

 @Library("c:\\extra_libs\\axonsoftware-jforex-utils.jar;c:\\extra_libs\\spread.jar")

Hint: use simple paths like c:\\extra_libs(or /home/user/extra_libs on Unix/MaxOS) this will reduce quantity of errors

Another important thing is adding symbols which is using in your strategy.
Dukascopy JForex platform allow you manage subscriptions for symbols what mean that market updates will be send to you only if you subscribed.
If you strategy working with EUR/USD, USD/JPY and EUR/GBP – dont forget to include them in subscriptions.

Original source