Dukascopy
 
 
Wiki JStore Search Login

Advanced counting problem
 Post subject: Advanced counting problem Post rating: 0   New post Posted: Wed 05 Oct, 2016, 13:08 
User avatar

User rating: 1
Joined: Mon 04 Apr, 2016, 12:33
Posts: 10
Location: Płaszow
Dear Amine Chourou

First I'd like to thank you for your proffesional work and kind help.
Last time you helped me a lot. Now I have another problem.

The idea is, that at some point from the place where I opened my position, i want to do partial close. The problem is that I don't know how to set the script to do this only one time per position. Now, the results are like in the picture exapmples. So, if price reach the point where i want to do this partial close, everything is allright. But if the price come back to this same point, it closes another part, and another, everytime when price is moving through encoded price levels.

The VJS example is attached. This is wery simple one, but I just wanted to give you an impression what I really talking about. So the point of entrance is non important

Thand you very much for your help.


Image
Image
Image


Attachments:
problem visualization.jpg [61.73 KiB]
Downloaded 429 times
breakpoint button.jpg [14.3 KiB]
Downloaded 417 times
market example.jpg [147.21 KiB]
Downloaded 381 times
Counter_Problem_example.vfs [42.79 KiB]
Downloaded 201 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: Advanced counting problem Post rating: 0   New post Posted: Wed 05 Oct, 2016, 13:09 
User avatar

User rating: 1
Joined: Mon 04 Apr, 2016, 12:33
Posts: 10
Location: Płaszow
I forgot to write about this "breakpoint" button. Is this a way to solve this problem ? :)


 
 Post subject: Re: Advanced counting problem Post rating: 0   New post Posted: Wed 05 Oct, 2016, 16:37 
Visual JForex expert at Dukascopy
User avatar

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

I'm happy to hear that you found a solution to your previous issues ! I hope you will this time as well :)


Your description is clear enough and my first thought was to use the position ID to identify the position that was partially closed but it appears that it is not really helpful especially for strategies that opens more than 1 position at a time. So the next idea was to use the position amount as an identifier: if it is not equal to the initial position amount opened then the strategy will not proceed to the partial close, else it will proceed.

PS: Pay attention to the minimum trading amount required in your strategy, I know that this is an example but it shows some errors related to that when a partial close is attempted


Attachments:
Counter_Problem_V2.vfs [44.16 KiB]
Downloaded 218 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: Advanced counting problem Post rating: 0   New post Posted: Wed 05 Oct, 2016, 17:14 
User avatar

User rating: 1
Joined: Mon 04 Apr, 2016, 12:33
Posts: 10
Location: Płaszow
The solution with amount as an identifier is so simple and so clever :-)
Of course i know that the minimal amount must be higher than normal, to avoid reducing obstacles.
I dont know why I couldn't come to this point :)

Thank you very much again


 
 Post subject: Re: Advanced counting problem Post rating: 0   New post Posted: Thu 06 Oct, 2016, 08:42 
User avatar

User rating: 1
Joined: Mon 04 Apr, 2016, 12:33
Posts: 10
Location: Płaszow
Im stuck again. Everything will be ok, if I would work on constant position size. But my positions are dynamic ( it means every trade will be different amount ) I'm sure there is a solution, but simple filter won't work.


 
 Post subject: Re: Advanced counting problem Post rating: 0   New post Posted: Thu 06 Oct, 2016, 10:39 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
I see.. Can you please send this strategy ?


 
 Post subject: Re: Advanced counting problem Post rating: 0   New post Posted: Thu 06 Oct, 2016, 12:02 
User avatar

User rating: 1
Joined: Mon 04 Apr, 2016, 12:33
Posts: 10
Location: Płaszow
This is the strategy. I hope you won't get lost ;) If you want i can give you java version or jfx with organized menu.

But back to the point.

1 ) Look that I made opened posision limit on trade event => one opened position = counter +1 / one closed position = counter -1 because i had problem to do that by label. I really tried but It wont work. Maybe I've done sth wrong, but I found this solution and it works properly. I cannot do this by normal and default "open Position" because I need to have few strategies working simultaneously. But If i will start doing partial closing, this counter will not be proper because when partial close occur ( and I implemented two spetps of partial close ) the counter will work like this.
a) start (counter =0)
b) open position ( counter = 0+1) =1
c) first partial close (counter = 1-1) =0 and now it is ready to open another position, even though it shouldn't ( because limit of only one position at the time )

As you can see it is more complicated :/

2 )Look at the risk calulation. It is "dynamic" but not so elastic as I wanted to. I cannot find a value, or how to calulate how much costs movement of 1 pips per one lot. In java and mql it is called "pipvalue". In jfx I can find only pipSize and pipScale. For now when I want to set risk per trade, I have to do some test and calulate what risk percent I need to set. For example. I set position with stop loss 20 pips. So I need to check, what loss will be for example for account 10 000 eur, but look that if i change stop loss for 40 pips my loss will be twice as bigger as before. If I could calculate pipvalue the amount wiould be really "dynamic" and I could for example set stoploss for 20 pips, set risk for 1% and it would calculate accurate position size.

3) Last question, is what is wrong with my days selection. If I set all of them to be traded ( value 1 ) everything is ok, but it wont work, if I turn off one day.

4) Is there any solution to sort the menu options or it can be done only manually in the exported java file?

Sorry for this massive post, but Im sure that in close time I will stop asking questions.

Ps If you want, I can send you java file with organized menu


Attachments:
Super_Trend_With_SMMA_V2.vfs [98.41 KiB]
Downloaded 196 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: Advanced counting problem Post rating: 0   New post Posted: Mon 10 Oct, 2016, 13:50 
Visual JForex expert at Dukascopy
User avatar

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

I've spent some time to think about this and we decided (with the team) to improve our trade event start point to handle such situation with "Partial fill" order status. This would require more time than expected so bear with us ..
meanwhile, I get back to my first idea with the use of Position ID but I noticed that you have a first partial fill and a second one. So in addition to PID use I've also added a logical trigger ("Go" variable)

I did not test this but I believe it works ..

Cheers


Attachments:
Super_Trend_With_SMMA_V3.vfs [101.59 KiB]
Downloaded 196 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: Advanced counting problem Post rating: 0   New post Posted: Wed 12 Oct, 2016, 08:00 
User avatar

User rating: 1
Joined: Mon 04 Apr, 2016, 12:33
Posts: 10
Location: Płaszow
Hi again.

Sorry for late reply but I wanted to check things properly.

Everything works fine and perfect :-)

I'm planning to add ferw more conditions on my own, but if I would have some problems, I will not hasitate to ask you again :)

Thanks again


 

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