Dukascopy
 
 
Wiki JStore Search Login

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

    Submit JForex API function requests in this forum only.
    Off topics are strictly forbidden.

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

More order states
 Post subject: More order states Post rating: 0   New post Posted: Thu 28 Nov, 2013, 11:11 
User avatar

User rating: 0
Joined: Sun 22 Sep, 2013, 22:29
Posts: 18
Location: RomaniaRomania
It seems to be quite confusing, especially when it comes to closing orders.

OPENED seems to come right away after submission, and it's a clear indication that the order wasn't FILLED yet.

However, closes are not reflected until they are done. My strategy could probably read an order as still on the table though I requested a close().
Therefore, there should be at least an intermediary IS_CLOSING state, that is set to the order right after close(), and until it becomes CLOSED.

Not sure if order changes as stop losses and take profits should require that.


 
 Post subject: Re: More order states Post rating: 0   New post Posted: Thu 28 Nov, 2013, 12:10 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
fxeconomist wrote:
However, closes are not reflected until they are done. My strategy could probably read an order as still on the table though I requested a close().
Therefore, there should be at least an intermediary IS_CLOSING state, that is set to the order right after close(), and until it becomes CLOSED.
How would you detect this state from another computer? That is:
  • Assume that on one pc you send a close request and the position is in state IS_CLOSING.
  • The other pc, however, won't be able to update the same position to IS_CLOSING state, until it receives some update from the server.
  • Most likely that such update of IS_CLOSING state would arrive together with confirmation/rejection of the position close.
Then what is the sense of such state?


 
 Post subject: Re: More order states Post rating: 0   New post Posted: Thu 28 Nov, 2013, 21:39 
User avatar

User rating: 0
Joined: Sun 22 Sep, 2013, 22:29
Posts: 18
Location: RomaniaRomania
API Support wrote:
fxeconomist wrote:
However, closes are not reflected until they are done. My strategy could probably read an order as still on the table though I requested a close().
Therefore, there should be at least an intermediary IS_CLOSING state, that is set to the order right after close(), and until it becomes CLOSED.
How would you detect this state from another computer? That is:
  • Assume that on one pc you send a close request and the position is in state IS_CLOSING.
  • The other pc, however, won't be able to update the same position to IS_CLOSING state, until it receives some update from the server.
  • Most likely that such update of IS_CLOSING state would arrive together with confirmation/rejection of the position close.
Then what is the sense of such state?


Yes, you are right, it needs an answer from the server. Quite similar happens when sending an order: there is no immediate switch to SUBMITTED, before OPENED. But OPENED is quite fast, I see many OPENED orders with a getOpenPrice() of 0.

I presumed that CLOSED requires effectively to close the order, implies the entire execution, and is much more slow than CANCELED, actually, it's as slow as FILLED.
During the execution, after I send the request, onTick may be fired, execution continues, therefore I should be able to tell the the algo "disregard these orders, as I said they should be closed". Since the CLOSED would come a bit later, the only way to do it is to provide an internal list with the labels of the orders requested to be closed, so that they are bypassed by the procedure looking for active orders. Later, they have to be removed from the list when ORDER_CLOSE_OK comes. So yes, it would rather help internally.

Any strategy that resides on a client's computer at home is prone to mistakes - power outage, internet connection failures, etc. In the end, strategies that really work will reside actually on your servers, so the connection to your trade server would work flawless.


 
 Post subject: Re: More order states Post rating: 0   New post Posted: Thu 05 Dec, 2013, 14:33 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
fxeconomist wrote:
I presumed that CLOSED requires effectively to close the order, implies the entire execution, and is much more slow than CANCELED, actually, it's as slow as FILLED.
How much slower is position closing than entry order cancelling on your pc? What is the difference when running the strategy on the remote server?


 
 Post subject: Re: More order states Post rating: 0   New post Posted: Thu 05 Dec, 2013, 19:35 
User avatar

User rating: 0
Joined: Sun 22 Sep, 2013, 22:29
Posts: 18
Location: RomaniaRomania
API Support wrote:
fxeconomist wrote:
I presumed that CLOSED requires effectively to close the order, implies the entire execution, and is much more slow than CANCELED, actually, it's as slow as FILLED.
How much slower is position closing than entry order cancelling on your pc? What is the difference when running the strategy on the remote server?


Oh, I never got to run them. I am learning, coding and backtesting. Demo run after backtest is flawless...


 

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