Dukascopy
 
 
Wiki JStore Search Login

How to prevent a strategy from opening the additional position?
 Post subject: How to prevent a strategy from opening the additional position? Post rating: 0   New post Posted: Tue 23 Jun, 2015, 20:19 
User avatar

User rating: 1
Joined: Wed 30 Jul, 2014, 14:33
Posts: 95
Location: Lithuania, Vilnius
My strategy opens the additional position, so I have more than one position opened simultaneously. Unfortunately, I don't know how to prevent the strategy from opening the additional position. The logic of the strategy is as follows: a position is opened after one green/red candle if two previous candles, pointing at the same direction, were not higher than 50 pips, or if two previous candles were different, i. e. one red candle and one green candle (in this case a position is being opened at the direction of the last candle). I created a strategy like this and I did not want to change the very logic of the strategy. Unfortunately, my strategy opens an additional position after two candles pointing at the same direction (see attachment).

Please, help me to set up my Strategy the right way. Thank You in advance.


Attachments:
RSIMACDprob4.vfs [67.12 KiB]
Downloaded 134 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: How to prevent a strategy from opening the additional position? Post rating: 0   New post Posted: Wed 24 Jun, 2015, 15:13 
User avatar

User rating: 0
Joined: Sun 01 Feb, 2015, 14:45
Posts: 65
Location: Algeria, Mila
hi man
if you want your strategy open only one position when the condition is true use this block
i hope i understand well your quistion


Attachments:
limit_positions.vfs [21.34 KiB]
Downloaded 127 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: How to prevent a strategy from opening the additional position? Post rating: 0   New post Posted: Thu 25 Jun, 2015, 10:32 
User avatar

User rating: 1
Joined: Wed 30 Jul, 2014, 14:33
Posts: 95
Location: Lithuania, Vilnius
Hi rossi7700,

Thank you for your answer. It's not the thing I need. I am already using the block, proposed by you, in my strategy. Unfortunately, it does not help. I need something else, its definitely. Anyway, thanks for the answer.

Kind regards,
kostakis


 
 Post subject: Re: How to prevent a strategy from opening the additional position? Post rating: 1   New post Posted: Thu 25 Jun, 2015, 11:57 
User avatar

User rating: 1
Joined: Thu 11 Jun, 2015, 11:47
Posts: 6
Location: Slovenia, Ljubljana
kostakis wrote:
Hi rossi7700,

Thank you for your answer. It's not the thing I need. I am already using the block, proposed by you, in my strategy. Unfortunately, it does not help. I need something else, its definitely. Anyway, thanks for the answer.

You can use Open Positions.Positions Amount in Position Info folder variable.
So check if Open Positions.Positions Amount is 0 then you should open new position.


 
 Post subject: Re: How to prevent a strategy from opening the additional position? Post rating: 0   New post Posted: Fri 26 Jun, 2015, 11:44 
User avatar

User rating: 1
Joined: Wed 30 Jul, 2014, 14:33
Posts: 95
Location: Lithuania, Vilnius
Gorazd_Jernejc wrote:
kostakis wrote:
Hi rossi7700,

Thank you for your answer. It's not the thing I need. I am already using the block, proposed by you, in my strategy. Unfortunately, it does not help. I need something else, its definitely. Anyway, thanks for the answer.

You can use Open Positions.Positions Amount in Position Info folder variable.
So check if Open Positions.Positions Amount is 0 then you should open new position.


Dear Gorazd_Jernejc,

I am already using this block. Unfortunately, it does not help to limit the number of open positions to 1 position. You can be assured of that if you took my strategy (attached) and would test it on Historical Tester.
Thank you for your answer and I am waiting for other suggestions.


 
The Best Answer  Post subject: Re: How to prevent a strategy from opening the additional position? Post rating: 0   New post Posted: Fri 26 Jun, 2015, 15:04 
User avatar

User rating: 1
Joined: Thu 11 Jun, 2015, 11:47
Posts: 6
Location: Slovenia, Ljubljana
kostakis wrote:
Dear Gorazd_Jernejc,

I am already using this block. Unfortunately, it does not help to limit the number of open positions to 1 position. You can be assured of that if you took my strategy (attached) and would test it on Historical Tester.
Thank you for your answer and I am waiting for other suggestions.


This is heppend because race condition.
You are using Multiple Action component, what cause that your strategy logic open two position at once, before server simulation set the Positions variable.

Check my attached solution.


Attachments:
RSIMACDprob4_x.vfs [67.57 KiB]
Downloaded 165 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: How to prevent a strategy from opening the additional position? Post rating: 0   New post Posted: Sat 27 Jun, 2015, 09:10 
User avatar

User rating: 1
Joined: Wed 30 Jul, 2014, 14:33
Posts: 95
Location: Lithuania, Vilnius
Hi,
Thank you so much for your help. Now it works perfectly. It was a really great solution.
Could you, please, help me with one more thing? This is an idea based on a counter with a loop, without the loop viewer block itself (see attachment). The system checks the MACD histo every 1 h and after 2 hours, if it stays below or above zero level, it gives you an alert (signal). The problem is that it gives you a signal every 2 hours but I need to have just one signal after 2 hours. In the other words I don't need to receive the signals after 4 hours, 6 hours, 8 hours etc. Unfortunately, I don't know how to eliminate the ensuing signals (4 hours, 6 hours, 8 hours etc.).
Please, help me to resolve the problem. I greatly appreciate your help in this matter. Thank you in advance.


Attachments:
DailyCheck1.vfs [30.31 KiB]
Downloaded 98 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: How to prevent a strategy from opening the additional position? Post rating: 0   New post Posted: Sat 27 Jun, 2015, 19:41 
User avatar

User rating: 1
Joined: Thu 11 Jun, 2015, 11:47
Posts: 6
Location: Slovenia, Ljubljana
kostakis wrote:
Hi,
Thank you so much for your help. Now it works perfectly. It was a really great solution.

Hi...
My solution isn't ideal (not 100%) because you are using Multiple Action component, so this is your bad program design. There is still a theoretical possibility to heppend double order at the some time. And my solution doesn't handle all needed ThereadEvents.

kostakis wrote:
Could you, please, help me with one more thing? This is an idea based on a counter with a loop, without the loop viewer block itself (see attachment). The system checks the MACD histo every 1 h and after 2 hours, if it stays below or above zero level, it gives you an alert (signal). The problem is that it gives you a signal every 2 hours but I need to have just one signal after 2 hours. In the other words I don't need to receive the signals after 4 hours, 6 hours, 8 hours etc. Unfortunately, I don't know how to eliminate the ensuing signals (4 hours, 6 hours, 8 hours etc.).
Please, help me to resolve the problem. I greatly appreciate your help in this matter. Thank you in advance.

Just create new custom boolean variable named, let say AlertSignal and set the default value to false.
When you get an alert signal first check the state of AlertSignal variable if it is false do alert and set AlertSignal variable to true, if it false then skip alert.


 
 Post subject: Re: How to prevent a strategy from opening the additional position? Post rating: 0   New post Posted: Sun 28 Jun, 2015, 13:01 
User avatar

User rating: 1
Joined: Wed 30 Jul, 2014, 14:33
Posts: 95
Location: Lithuania, Vilnius
Quote:
Just create new custom boolean variable named, let say AlertSignal and set the default value to false.
When you get an alert signal first check the state of AlertSignal variable if it is false do alert and set AlertSignal variable to true, if it false then skip alert.


Thank you so much for your prompt answer. I tried to do that. Unfortunately, I am not a programmer and I failed. Could you please do that for me in the strategy attached?
Thank you in advance.


Attachments:
RSIMACDprob4A_1.vfs [73.77 KiB]
Downloaded 133 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: How to prevent a strategy from opening the additional position? Post rating: 0   New post Posted: Tue 30 Jun, 2015, 01:45 
User avatar

User rating: 0
Joined: Mon 15 Jun, 2015, 13:09
Posts: 15
Location: Australia, St Ives
Hi

I have been having this problem or similar I guess and had extensive discussions with support team. It seems that testing/running systems on live data feed through VJF or compiling them and running them in JForex platform ""LOCALLY" causes this issue. I am not too sure as why this happens.

Try to run your system on JForex platform on "REMOTE RUN" I am pretty sure that will resolve your issue.

Here is the link to my thread regarding this issue might be helpful. Let me know how it works out for you.
https://www.dukascopy.com/swiss/english ... 46&t=52820
Cheers


 
 Post subject: Re: How to prevent a strategy from opening the additional position? Post rating: 0   New post Posted: Tue 30 Jun, 2015, 07:34 
User avatar

User rating: 1
Joined: Wed 30 Jul, 2014, 14:33
Posts: 95
Location: Lithuania, Vilnius
fxprodgy wrote:
Hi

I have been having this problem or similar I guess and had extensive discussions with support team. It seems that testing/running systems on live data feed through VJF or compiling them and running them in JForex platform ""LOCALLY" causes this issue. I am not too sure as why this happens.

Try to run your system on JForex platform on "REMOTE RUN" I am pretty sure that will resolve your issue.

Here is the link to my thread regarding this issue might be helpful. Let me know how it works out for you.
https://www.dukascopy.com/swiss/english ... 46&t=52820
Cheers

Hi,
Thanks a lot for your answer. However, Gorazd_Jernejc already helped me with this issue. You can find his solution of this problem above. Again, thank you for your help.


 
 Post subject: Re: How to prevent a strategy from opening the additional position? Post rating: 0   New post Posted: Fri 03 Jul, 2015, 16:25 
User avatar

User rating: 1
Joined: Wed 30 Jul, 2014, 14:33
Posts: 95
Location: Lithuania, Vilnius
fxprodgy wrote:
Hi

I have been having this problem or similar I guess and had extensive discussions with support team. It seems that testing/running systems on live data feed through VJF or compiling them and running them in JForex platform ""LOCALLY" causes this issue. I am not too sure as why this happens.

Try to run your system on JForex platform on "REMOTE RUN" I am pretty sure that will resolve your issue.

Here is the link to my thread regarding this issue might be helpful. Let me know how it works out for you.
https://www.dukascopy.com/swiss/english ... 46&t=52820
Cheers

Hi,

You were absolutely right my friend. I ran my strategy on JForex platform using "REMOTE RUN" and everything was ok. It opens just 1 trade simultaneously. It means that Open Positions.Positions Amount block works properly. The question is why it does not work on "LOCAL RUN". I applied with this question to support team before, unfortunately I got no answer. If to be precise, my question was, why my strategy opened multiple positions in spite the Open Positions.Positions Amount block was implemented. Unfortunately, the issue was not explained to me.
It would be interesting to find out how it works on real account. If you have any experience in that please, share it with me.
Thank you again my friend.


 

Jump to:  

  © 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