Dukascopy Support Board
http://www.dukascopy.com/swiss/english/forex/jforex/forum/

Strategy opens more trades than set in parameters
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=141&t=51651
Page 1 of 1

Author:  rokasltu [ Tue 09 Sep, 2014, 14:15 ]
Post subject:  Strategy opens more trades than set in parameters

Hello,

I made strategy in visual jforex dedicated for sharp moves catching with limitation to 1 opened trade in default instrument (EUR/USD). I use counting of open positions which instrument equals to default instrument and if number of positions is 0 strategy goes to logic which is responsible for decisions to open position or not. In another case strategy goes to logic which is responsible for closing position if certain criteria are met.

After that I built strategy and copied code to jforex platform. But when it runs live I noticed that in about 50% cases not 1 but 2,3 or even 4 positions are opened at nearly same time. Please check why set limitation works incorrectly.

And I cannot attach visual jforex strategy file - I get message "Sorry, the board attachment quota has been reached."
Maybe I can sent this file by e-mail?

Best regards,
rokasltu

Author:  amine_chourou [ Tue 09 Sep, 2014, 16:15 ]
Post subject:  Re: Strategy opens more trades than set in parameters

Greetings,

Thanks for your post.
Kindly resend your email with the attachment to [email protected] and address it to me. I'll follow up and keep you updated.

Thanks

Author:  amine_chourou [ Wed 10 Sep, 2014, 12:22 ]
Post subject:  Re: Strategy opens more trades than set in parameters

Hi,

We've received your strategy and thanks for that.
Can you please explain your use of the counter as it I did not understand it (the number calculation). Why are you using it ?
If your aim is limit the open positions to one then a simple IF condition with the number of position is enough.
In addition, the position viewer block could be limited to one.

Thanks

Author:  rokasltu [ Wed 10 Sep, 2014, 12:45 ]
Post subject:  Re: Strategy opens more trades than set in parameters

Hi,

As besides jforex robot I also trade manually in another currency pairs and if there are open positions in another currency pairs but not in currency pair EUR/USD which is used for automated trading and another criteria are met robot should open EUR/USD position. (along another open positions in another currency pairs)

That's why I use position viewer block for going through of all open position but variable "number" is increased by 1 only in case open position instrument is equal to EUR/USD.

After counting is done my logic splits in two parts: if there is no open position in EUR/USD ("number"=0) it goes to part which decides to open position or not and if there is open position already (and as I mentioned in about 50% of cases there are more than 1 open position in EUR/USD) it goes to part which decides to close this position or not. In this part I also use position viewer block in order to go through all open positions but to proceed with possible closing only if open position instrument is equal to EUR/USD.

That's is reason for using mentioned logic. But as I mention robot opens more than 1 position in EUR/USD pair at a time and this opening happens nearly at the same time. I mean that if e.g. 3 positions are opened and some time passes (e.g. 1 second) after that robot do not open additional positions until mentioned open positions are closed. Please check why this happens.

Best regards,
rokasltu

Author:  amine_chourou [ Wed 10 Sep, 2014, 15:08 ]
Post subject:  Re: Strategy opens more trades than set in parameters

Understood,

This behavior is quite random but as you are trading on tick start + the way you assembled your blocks increases the chances of getting more then one position.
I believe there is another workaround. I'll try to check this and get back to you asap.

Thanks

Author:  Ristoril [ Mon 27 Mar, 2017, 18:30 ]
Post subject:  Re: Strategy opens more trades than set in parameters

I wanted to add I have observed this phenomenon as well. Using position viewer to limit trades to , for example, EURUSD, it will open a trade as long as no other EURUSD positions are open. However sometimes I think the strategy loses connection maybe to the server info that gives it the positioninfo and positioninstrument count, then it thinks those values are 0, so it allows another trade to go through?

That is my theory anyway.

Author:  amine_chourou [ Tue 28 Mar, 2017, 14:12 ]
Post subject:  Re: Strategy opens more trades than set in parameters

Hi All,

Things has changed since the beginning of this post and the Variables "Positions" in the left panel use to be linked to the used instrument only but since more than a year the position amount variable handles any open position.
Also, the position viewer block can handle positions per traded instrument. Check the attached "random" example

Image

Besides, we have currently an outstanding issue related to strategy processor connectivity, so this might impact the normal behavior of a strategy at some point.

If you need an counter per open position and traded instrument let me know

Attachments:
CLoseEURUSDwithSLAndAnyEURCHF.JPG [110.83 KiB]
Downloaded 689 times

  Page 1 of 1