Dukascopy
 
 
Wiki JStore Search Login

rule 2.8 : no Jar allowed
 Post subject: rule 2.8 : no Jar allowed Post rating: 0   New post Posted: Wed 27 Oct, 2010, 15:39 

User rating: 0
Joined: Tue 10 Nov, 2009, 16:58
Posts: 65
Hi,

I propose that external JAR files are allowed, provided the contestant is the author of the JAR file, and all .java sources to recreate the JAR file are provided along the main strategy source file.

Rationale:

Getting around bugs or missing functionality, keeping strategy code clean, sometimes requires using additional, non-inner defined java classes.

For example, IOrder.getLabel() does not currently work for orders submitted in a previous strategy run, as the order history does not keep label or comment data.
See viewtopic.php?f=9&t=22171&hilit=getlabel

To remediate this problem, I use a serializable HashMap containing the extra per-order data. If this data structure is defined as an inner class of the strategy, serialization (for writing to a file) is not possible because IStrategy is not Serializable. Even if it were, that would lead to extraneous unneeded data writen to the file. Therefore, the serialization classes must be defined in their own .java file so that Serialization only involves the classes concerned.

Unfortunately, JForex does not seem to find and load .class files placed along the strategy class. To circumvent this, I created a JAR file containing my additional classes, and referenced with @Library in the Strategy source. This works fine, but obviously violates the current rules, even though there is no use of a "black box".

Since the intent is only to fix a bug and limitation of the platform, such use of a JAR file should be allowed.

Please consider this rule change.

Thanks !


 
 Post subject: Re: rule 2.8 : no Jar allowed Post rating: 0   New post Posted: Thu 28 Oct, 2010, 21:29 

User rating: 1
Joined: Fri 26 Mar, 2010, 19:19
Posts: 116
Location: Canada
jforex can't stamp a strategy ID on external files. so there's currently no way to prevent people from gaming the system if external files are allowed.


 
 Post subject: Re: rule 2.8 : no Jar allowed Post rating: 0   New post Posted: Fri 29 Oct, 2010, 10:39 
User avatar

User rating: 8
Joined: Wed 21 Apr, 2010, 10:42
Posts: 1167
That's true. Running a strategy from a single jar is more difficult to control. We are not able to see the strategy_ID and external_ID on the trades. For the moment, you can run the strategy only in the Jforex platform.

Starting from November, you can also you the Remote Server! We will grant all users with 1 slot to run the strategy remotely.


 
 Post subject: Re: rule 2.8 : no Jar allowed Post rating: 0   New post Posted: Mon 01 Nov, 2010, 20:06 

User rating: 0
Joined: Tue 10 Nov, 2009, 16:58
Posts: 65
ok I get that you can not ID the external JAR automatically. I guess submitting an MD5 checksum would be the same... but then more work for you guys to keep track of and check.


 
 Post subject: Re: rule 2.8 : no Jar allowed Post rating: 0   New post Posted: Thu 04 Nov, 2010, 15:01 

User rating: 0
Joined: Tue 10 Nov, 2009, 16:58
Posts: 65
allright, I recoded to use my own file reader/writer and parser.

This is just so I can store some per-trade information for my strategy while it runs, since an IOrder label is not preserved in the history. Without this cache, if my strategy stops for whatever reason (reboot, network failure, etc.) the per-trade information is lost, and so the strategy would not know what state it was in just before the failure.

Again, to be clear, the cache is created by the strategy when it starts, while it runs. There is no code or data provided to the strategy initially. The strategy creates the cache on it's own from it's own running data.

I do not see any JForex contest rule against using an external information cache created by the strategy, so can you confirm that is ok ?

Thanks


 
 Post subject: Re: rule 2.8 : no Jar allowed Post rating: 0   New post Posted: Thu 04 Nov, 2010, 15:06 
User avatar

User rating: 8
Joined: Wed 21 Apr, 2010, 10:42
Posts: 1167
Can you show what exactly you're planning to do and how?


 
 Post subject: Re: rule 2.8 : no Jar allowed Post rating: 0   New post Posted: Thu 04 Nov, 2010, 17:20 

User rating: 0
Joined: Tue 10 Nov, 2009, 16:58
Posts: 65
Basically, when the strategy starts, it checks if a cache file exists. If not, the strategy creates the file on the first trade. If the file exists, the strategy reads its information (it needs to know about past trades). The file is a clear text file containing trade id, fill time, label, etc. like below
VBMNovemberusch0L0,12110294-1,0,true,1288860600955,0.96781,0.9477,0.9733099999999999,0.192,false
VBMNovemberusch1L1,12151042-2,1,true,1288869600415,0.9687,0.9486,0.9705,0.336,false
VBMNovemberusch2L2,12151216-3,2,true,1288869661525,0.96859,0.9485,0.9700899999999999,0.48000000000000004,false


I can email you the code if you need more details.


 
 Post subject: Re: rule 2.8 : no Jar allowed Post rating: 0   New post Posted: Thu 04 Nov, 2010, 17:45 
User avatar

User rating: 8
Joined: Wed 21 Apr, 2010, 10:42
Posts: 1167
Is it logging only? Or you're using this information to open new trades in the future?

We can accept this only if it's for the strategy logging.


 
 Post subject: Re: rule 2.8 : no Jar allowed Post rating: 0   New post Posted: Fri 05 Nov, 2010, 08:40 

User rating: 0
Joined: Tue 10 Nov, 2009, 16:58
Posts: 65
if the strategy never crashes, or the computer never reboots, the file is not necessary as the strategy keeps all its settings internally. This is just so that in case of restart, the strategy can find what its state was when the crash happened or was stopped and continue where it was as if it had not been interrupted.

My first version used Order labels to keep the information, however I discovered that although this works fine in the Tester (and in the demo while orders are open), the order history does not preserve the IOrder labels. So, to circumvent that BUG on the order history (I mean it's got to be a bug since the behavior is inconsistent and it is listed on the forums as bug JFOREX-2204...), I had to create a mechanism using a file created and managed by the strategy. So it's not something that is fed to the strategy to modify it, or that is fetched from elsewhere etc. In addition, if the strategy is never stopped or never crashes, then the file is never read. It's basically a running memory dump to restore state to recover from a system failure.

I can remove that facility, but then it means that in case of crash, my strategy will not know what the position it opened "means" when it restarts, and I will have to manually close the positions so the strategy can start cleanly again.

the closest applicable rules I see would be

8. No “black boxes” (as commonly known in the industry) are allowed. Strategy’s trading algorithms must be fully scripted inside the JForex platform. Participants are not allowed to use external files (DLL, JAR, etc), and/or MT4 strategies with MT4-JForex Clients Bridge.

all the algorithms are scripted in the strategy, the file created by the strategy is not code, only trade states. So no black box, DLL, jars, MT4 code, etc. The file is readable text as shown in my previous posts, so it's definitely not a black box.
9. The strategy’s parameters must be hardcoded inside the script. Annotation @Configurable is prohibited for use. In exceptional cases, the contestant may change the parameters upon receiving a preliminary consent by Dukascopy.

all parameters are hardcoded in the script, no @Configurable is used. Nothing is used by the strategy that was not computed or done by the strategy itself in the first place.

So, is this use ok ? The file is plain text, written in the JForex/Strategies/files. No full access required. Please confirm this as I am just trying to make my strategy more reliable (in previous months, I hit issues because my computer crashed, or I stopped the strategy for a while, etc. I want to avoid those issues and make my strategy more reliable)


 
 Post subject: Re: rule 2.8 : no Jar allowed Post rating: 0   New post Posted: Mon 08 Nov, 2010, 15:09 

User rating: 0
Joined: Tue 10 Nov, 2009, 16:58
Posts: 65
support, could you confirm if I can do that or not ? if not I'll disable th efeatur and pray my strategy/computer does not crash...

thanks


 
 Post subject: Re: rule 2.8 : no Jar allowed Post rating: 0   New post Posted: Tue 09 Nov, 2010, 13:37 

User rating: 0
Joined: Tue 10 Nov, 2009, 16:58
Posts: 65
I'd really like an understanding if this is ok or not according to the rules...
please let me know. Thanks


 
 Post subject: Re: rule 2.8 : no Jar allowed Post rating: 0   New post Posted: Tue 09 Nov, 2010, 16:29 
User avatar

User rating: 8
Joined: Wed 21 Apr, 2010, 10:42
Posts: 1167
Can you please send me your strategy? You can remove all logic and secret formulas, just leave the mechanism which saves the trade data in the file. Thanks! prompt reply is guaranteed! :)


 

Jump to:  

cron
  © 1998-2024 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