Dukascopy
 
 
Wiki JStore Search Login

Converted code
 Post subject: Converted code Post rating: 0   Post Posted: Thu 12 Dec, 2013, 12:05 

User rating: 1
Joined: Mon 02 Dec, 2013, 11:32
Posts: 27
Location: AustraliaAustralia
Hi

Is there anyway to see the .java equivalent code of a compiled mq4 file?

I have managed to compile one of my strategies, but it doesn't produce any trades when run in historical tester, so i know there are going to be issues with it.
If there was a way to see the java cose I could then use this as a template to adjust my code, rather then having to retype out the whole thing.

thanks


 
 Post subject: Re: Converted code Post rating: 0   Post Posted: Thu 12 Dec, 2013, 13:08 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
The connector API is not public, if you wish to find out why the trades don't get created, consider adding some Print messages in the mq4 file. If you still can't it figure out, please post your strategy here, or if you don't want to make the code public, write to [email protected].


 
 Post subject: Re: Converted code Post rating: 0   Post Posted: Fri 13 Dec, 2013, 00:47 

User rating: 1
Joined: Mon 02 Dec, 2013, 11:32
Posts: 27
Location: AustraliaAustralia
I am sure the reason there are no trades is to do with the conversion process and the use of custom indicators in the strategy.
Please see my other post regarding converting the DTOSC indicator. As these do not work on their own, that will be a large contribution to the problem.

Do you intend to make the conversion process public at all, or add the facility to output a text file with the converted code? It would save everyone a huge amount of time.
I don't expect anyone to do the work for me, i need to learn this myself so that i can make constant improvements to the strategies, so I just need a little guidance. :)


 
 Post subject: Re: Converted code Post rating: 0   Post Posted: Fri 13 Dec, 2013, 10:34 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
PhoenixProject wrote:
Do you intend to make the conversion process public at all, or add the facility to output a text file with the converted code?
No we don't.
PhoenixProject wrote:
It would save everyone a huge amount of time.
This is questionable, since the Connector api changes with every new release, meaning that on every new release there would be a possibility that you would need to rewrite your java code for it to compile. If there is something that does not work, please report an issue and we are going to fix this in the future releases.


 
 Post subject: Re: Converted code Post rating: 0   Post Posted: Fri 13 Dec, 2013, 15:11 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Quote:
It would save everyone a huge amount of time.

I am also voting for this request.

Quote:
since the Connector api changes with every new release, meaning that on every new release there would be a possibility that you would need to rewrite your java code for it to compile

This is the case sometimes with a new API release. For example the last one of them was the instrument subscription. When that become mandatory on the remote platform, people started to ask for help, as all of a sudden a strategy was not working anymore... And at the end everyone was informed that you have to modify the code for the new API...
I don't see a point in being afraid that upon a new converter release the old code should be modified. Just make a checkbox available with the text: "Use at your own risk"... :)


 
 Post subject: Re: Converted code Post rating: 0   Post Posted: Fri 13 Dec, 2013, 16:01 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
tcsabina wrote:
This is the case sometimes with a new API release. For example the last one of them was the instrument subscription. When that become mandatory on the remote platform, people started to ask for help, as all of a sudden a strategy was not working anymore... And at the end everyone was informed that you have to modify the code for the new API...
That was a rare exception, not a routine which it is in the converter case.
tcsabina wrote:
I don't see a point in being afraid that upon a new converter release the old code should be modified.
Assume you have a client with zero competence in programming, who uses your strategy, which would be a modified converted mq4 code - now on every platform release you will need to supply him with an updated version of his strategy. Not only you would need to adjust the source code, you might also need to thoroughly test it in order to make sure that it works the same way as before.

Besides, the MQL4Connector (i.e., MT4 API implementation using JForex-API) sources have always been available in our public repository:
https://publicrepo.site.dukascopy.com/jforexlib/publicrepo/com/dukascopy/connector/MQL4Connector/2.9.5.1/


 
 Post subject: Re: Converted code Post rating: 0   Post Posted: Sun 15 Dec, 2013, 00:24 

User rating: 1
Joined: Mon 02 Dec, 2013, 11:32
Posts: 27
Location: AustraliaAustralia
I think the point is though, that it would be a great learning tool.
I imagine there are many people, that are moving from MT4 to Jforex. This represents for most people a huge amount of time in relearning code.
If there were some help notes to do this conversion then that would be fine also ie MT4 worked this way, JForex does it this way. eg Normalizedoubles to avoid rounding issues etc.

For every component of code we need to go through and work out what the new syntax is or how to avoid the issue etc.

If we could see the output from the conversion this would help a lot, as we could then see how Jforex attempts to represent the same code.

It's definitely in the interests of Dukascopy - the longer it takes people to transfer their strategies and to learn syntax, the longer the period that they won't be trading a live account.


 
The Best Answer  Post subject: Re: Converted code Post rating: 0   Post Posted: Mon 16 Dec, 2013, 10:03 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
For particular MT4 API module implementations see the folder \MQL4Connector-2.9.5.1-sources\com\dukascopy\connector\lib\impl\. For Normalizedouble see StringFunctions.NormalizeDouble. For trading operations see TradingFunctions etc. If you wish to browse the code from your IDE, simply add in the pom.xml file the dependency:
      <dependency>
         <groupId>com.dukascopy.connector</groupId>
         <artifactId>MQL4Connector</artifactId>
         <version>2.9.5.1</version>
         <classifier>sources</classifier>
      </dependency>

PhoenixProject wrote:
For every component of code we need to go through and work out what the new syntax is or how to avoid the issue etc.
If you are using an IDE, the syntax should not be a big issue, as you get instant fix suggestions, the worst case - you can lookup the java SE tutorials for java syntax.
PhoenixProject wrote:
If we could see the output from the conversion this would help a lot, as we could then see how Jforex attempts to represent the same code.
It may not be the best idea to "represent the same code", as, for example, one may find it more convenient to refer to trades, chart objects, historical data as objects rather accessing them by using string constants. Moreover programming your strategy similar way may lead to unnecessary sophistication of your code, since you are actually writing your code in Java SE, which has powerful API that facilitates doing many common routines.
PhoenixProject wrote:
It's definitely in the interests of Dukascopy - the longer it takes people to transfer their strategies and to learn syntax, the longer the period that they won't be trading a live account.
For that purpose there are javadocs, wiki and ultimately the support forum to help you learn how to write strategies in the JForex-API:
  1. In javadocs not only contain elaborate method and their parameter descriptions, but also the essential methods contain usage examples (see, for instance, IEngine.submitOrder). This is the documentation you get when you write your strategies within a IDE.
  2. In wiki you find more of a functionality overview, with each section being supplied by at least one example strategy. Regarding the rounding issue for your case see: https://www.dukascopy.com/wiki/#Rounding_prices
  3. If you have not found the answer in the first two, you can post your issue/inquiry in the Automated Trading support forum.


 

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