Dukascopy
 
 
Wiki JStore Search Login

Visual JForex Coding
 Post subject: Visual JForex Coding Post rating: 0   New post Posted: Mon 29 Jun, 2015, 21:32 
User avatar

User rating: 2
Joined: Fri 02 Mar, 2012, 22:08
Posts: 200
Location: New Zealand, Dunedin
Hi

I have at last decided to try and understand how to code in Visual JForex

I took LinnuxFX's JForex strategy for June 2015 competition - [NewBalancev8]

I reduced the four amount values to 0.1 from 7 and ran the strategy using the historical tester

It would appear to have the ability to open multiple trades at the same time - so that the use of leverage goes through the roof and the consequences can be fatal !

Given that the strategy contains the usual block prior to each Trading Block which checks to see that the number of positions is ZERO before it opens a trade how does the opening of multiple trades at the same time happen ?

Apologies if I am not understanding the code in LinnuxFX's strategy :)

Bob M


 
 Post subject: Re: Visual JForex Coding Post rating: 0   New post Posted: Tue 30 Jun, 2015, 10:46 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
Hi,

Well, basically the code is a set of instructions given to the system to be executed. If there is no condition preventing an action to be made, it will be executed forever:
Let's take an example of a strategy that trades on 1mn candles with couple of conditions, if these conditions are met the system will keep sending orders on every 1mn candle till the conditions stops the flow. Let suppose that the strategy is not including any condition related to the trading period, in other words, the trading conditions are plugged directly to the candle start point without any specification related to the default trading period: In this case, the system will execute conditions based on all possible trading periods from 10 seconds till monthly and as a result the user will see several orders sent to the market (every 10 seconds IF the trading conditions are met)

From what I seen before, some cases of multiple positions could occur when there is no specification related to the BID / ASK prices or in case there in an inconsistency related to that: The code will then retrieve BID and ASK prices and could trade on both of them realizing duplications (redundancy) or if the logical conditions are distributed in parallel so that the position number condition cannot be updated as fast as needed to prevent sending multiple orders. In such cases, a modification of the logical flow of the strategy would stop such problems.

Hope this helps


 
 Post subject: Re: Visual JForex Coding Post rating: 0   New post Posted: Tue 30 Jun, 2015, 17:52 
User avatar

User rating: 2
Joined: Fri 02 Mar, 2012, 22:08
Posts: 200
Location: New Zealand, Dunedin
Hi

Thank you for your response

Sure - I get the bit about an action repeating if there is no code to stop it BUT in my simple mind I thought that the standard block which checks for "number of positions" and which is actioned just prior to each possible Buy or Sell action was all that is required to STOP multiple simultaneous trades :)

Bob M


 
 Post subject: Re: Visual JForex Coding Post rating: 0   New post Posted: Wed 01 Jul, 2015, 14:35 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
Hi,

Quote:
I thought that the standard block which checks for "number of positions" and which is actioned just prior to each possible Buy or Sell action was all that is required to STOP multiple simultaneous trades

It should indeed! There is other ways to do that without using the number of open positions such as using logical triggers:
If position A is filled-->Then you let the flow going
Esle --> block it

a simple Boolean variable would do the job, check this example and the variables Go_Long / Short

Cheers


Attachments:
Webinar5_11.vfs [42.31 KiB]
Downloaded 130 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: Visual JForex Coding Post rating: 0   New post Posted: Fri 03 Jul, 2015, 21:48 
User avatar

User rating: 2
Joined: Fri 02 Mar, 2012, 22:08
Posts: 200
Location: New Zealand, Dunedin
Thank you but I would still like an answer to my basic question......................

1) Please would somebody test the attached strategy on the historical tester (local run) and verify that sometimes multiple simultaneous trades are opened

2) If (1) is true, could somebody then explain to me why that happens given that the code supposedly checks the 'number of positions open' prior to each trade block in the strategy

Many thanks for your time and patience

Bob M


Attachments:
newBALANCE.java [30.84 KiB]
Downloaded 139 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: Visual JForex Coding Post rating: 0   New post Posted: Sat 18 Jul, 2015, 01:10 
User avatar

User rating: 2
Joined: Fri 02 Mar, 2012, 22:08
Posts: 200
Location: New Zealand, Dunedin
Hi Support........................

Please can you answer my basic question.............

Thank you

Bob M


 
 Post subject: Re: Visual JForex Coding Post rating: 0   New post Posted: Mon 20 Jul, 2015, 09:31 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
Hi,

Quote:
1) Please would somebody test the attached strategy on the historical tester (local run) and verify that sometimes multiple simultaneous trades are opened


Kindly attach the original vfs file so that I can test it.

2) If (1) is true, could somebody then explain to me why that happens given that the code supposedly checks the 'number of positions open' prior to each trade block in the strategy

As explained, there could be some cases where the number of open positions did not get updated on time because of a simultaneous flow for instance but this needs to be verified thoroughly.

Thanks


 
 Post subject: Re: Visual JForex Coding Post rating: 0   New post Posted: Wed 22 Jul, 2015, 16:55 
User avatar

User rating: 2
Joined: Fri 02 Mar, 2012, 22:08
Posts: 200
Location: New Zealand, Dunedin
Hi

I attached the java file on the 3rd July (see above)

Bob M


Attachments:
newBALANCE.java [20.14 KiB]
Downloaded 135 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: Visual JForex Coding Post rating: 0   New post Posted: Thu 23 Jul, 2015, 09:50 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
Hi

As already requested, please attach the original .VFS file generated by Visual Jforex platform and not ".java" or ."jfx" files.

Thanks


 
 Post subject: Re: Visual JForex Coding Post rating: 0   New post Posted: Thu 23 Jul, 2015, 19:53 
User avatar

User rating: 2
Joined: Fri 02 Mar, 2012, 22:08
Posts: 200
Location: New Zealand, Dunedin
In July's strategy contest - see LinnuxFX's strategy

help yourself

Bob M


 
 Post subject: Re: Visual JForex Coding Post rating: 0   New post Posted: Fri 24 Jul, 2015, 16:25 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
Hi,

Quote:
1) Please would somebody test the attached strategy on the historical tester (local run) and verify that sometimes multiple simultaneous trades are opened


Yes it is, and the reason couldn't be that obvious due to the errors that are generated by the strategy which is mainly due to the bad implementation:
1/ An excessive and wrong use of multiple action block that generate errors: The CCI is 1 h based where the MACDs are 1mn, the flow is distributed simultaneously till the IF block that uses the output CCI_0. The problem is if the flow reaches the if block after one mn where the CCI 1 h did not get any value, the IF comparison becomes inconstant
2/ The period filter needs to use the candle period so that the system will subscribe on the requested candles period (1mn / 1 h)
3/ If you need several indicators with a dedicated period each, avoid using default period but a selected one instead (from the drop down list in period's field)
4/ The "Get historical candle" block is unused -
5/ The number of open position filter that you were referring to: The condition is saying : Number of ALL open orders/Positions = < 0 ??? where the number of open positions is a positive integer.

With the elements above, the strategy was somehow bypassing the IF filter and several errors were populated in Java console. You may need to review carefully the attached example in order to avoid such errors in the future.

Cheers


Attachments:
newBALANCE_V2.vfs [40.52 KiB]
Downloaded 135 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: Visual JForex Coding Post rating: 0   New post Posted: Sun 26 Jul, 2015, 21:29 
User avatar

User rating: 2
Joined: Fri 02 Mar, 2012, 22:08
Posts: 200
Location: New Zealand, Dunedin
Firstly, many thanks for your reply

The errors are noted and I am pleased that you took the time to correct them and provide a new example code.

One last question:-

Why is it that on a live platform and a demo platform the original code generated simultaneous trades whereas on the competition strategy platform it didn't?

Many thanks

Bob M


 
 Post subject: Re: Visual JForex Coding Post rating: 0   New post Posted: Mon 27 Jul, 2015, 08:49 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
Hi,

Quote:
Why is it that on a live platform and a demo platform the original code generated simultaneous trades whereas on the competition strategy platform it didn't?


Because there is a limitation condition implemented at the level of the server (strategy contest server) that prevent your code from submitting more than a trade. You can find more information in your strategy logs.

Cheers


 
 Post subject: Re: Visual JForex Coding Post rating: 0   New post Posted: Fri 31 Jul, 2015, 16:07 
User avatar

User rating: 2
Joined: Fri 02 Mar, 2012, 22:08
Posts: 200
Location: New Zealand, Dunedin
This discussion has highlighted the fact that:-

A competitor can submit a strategy which is poorly coded and which in normal circumstances would not adhere to the one-trade rule but because of Dukascopy's setup on the competition platform - it appears that the strategy DOES adhere to the one-trade rule.

I suggest that Dukascopy would do a better service to all competitors by allowing the competition platform to behave as a standard demo platform would i.e. any strategy which normally would not adhere to the one-trade rule would behave thus in the competition and would be disqualified at the end of the month.

That way, the competitor learns about coding, becoming aware of his/her POOR coding and hopefully corrects his strategy for the following month's competition.

Just my thoughts.................

Bob M
NewZealand


 

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