Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

enter and close at the same time
 Post subject: enter and close at the same time Post rating: 0   New post Posted: Tue 17 May, 2011, 03:58 

User rating: 0
Joined: Tue 17 May, 2011, 03:57
Posts: 1
Hello, my strategy's entry signal is also my exit signal. In other word, when the signal is triggered, I'm opening new position and close existing position (if any) at the same time. How do I program java to achieve this?

Thank you!


 
 Post subject: Re: enter and close at the same time Post rating: 0   New post Posted: Tue 17 May, 2011, 15:53 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
See:
https://www.dukascopy.com/wiki/index.php ... ose_Orders
and
https://www.dukascopy.com/wiki/index.php?title=Place_Bid


 
 Post subject: Re: enter and close at the same time Post rating: 0   New post Posted: Wed 18 May, 2011, 14:49 

User rating: -
Thanks for the quick reply.

I do know how to place bid and close order. What I was trying to clarify is how do I place them at the same time and have JForex execute these orders without losing one of them. When I tested my strategy, for some reason, only one was filled and the other was ignored. And I cannot figure out why.


 
 Post subject: Re: enter and close at the same time Post rating: 0   New post Posted: Thu 19 May, 2011, 09:54 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Could you please post the part of your code that closes the order and opens a new one? Do you check the results of your requests? You need to correctly handle situations when one of the close or open requests is rejected. In this situation you can repeat the request or maybe if it happens too often increase the slippage.


 

Jump to:  

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