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.

canceled OR closed?
 Post subject: canceled OR closed? Post rating: 0   New post Posted: Fri 22 Nov, 2013, 19:27 
User avatar

User rating: 0
Joined: Sun 22 Sep, 2013, 22:29
Posts: 18
Location: RomaniaRomania
Opposed to MetaTrader, that has a distinct OrderDelete() for pending orders and OrderClose() for filled orders, Jforex has a single close() method.

I presume that a close() call on a fully FILLED order would set the state to CLOSED. But in which case a close() would set the order state to CANCELED ?

a) A close() call on a CREATED order?
b) A close() call on an OPENED order?
c) A close() call on a partially FILLED order?


 
 Post subject: Re: canceled OR closed? Post rating: 0   New post Posted: Fri 22 Nov, 2013, 23:39 
User avatar

User rating: 96
Joined: Mon 09 Sep, 2013, 07:09
Posts: 287
Location: Ukraine, SHostka
https://www.dukascopy.com/wiki/#Order_state


 
 Post subject: Re: canceled OR closed? Post rating: 0   New post Posted: Sat 23 Nov, 2013, 01:23 
User avatar

User rating: 0
Joined: Sun 22 Sep, 2013, 22:29
Posts: 18
Location: RomaniaRomania
hebasto wrote:


Thanks! I was looking only in the classes documentation.


 
 Post subject: Re: canceled OR closed? Post rating: 1   New post Posted: Mon 25 Nov, 2013, 08:18 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
You can use the onMessage() function for further testing, as it is called always when an order changes states.
This code snippet could be used:
    public void onMessage(IMessage message) throws JFException {
        SimpleDateFormat sdf;
        IOrder anOrder;

        sdf = new SimpleDateFormat("yyyy-MM-dd_HHmmss");
        sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
        anOrder = message.getOrder();
        switch (message.getType()) {
            case ORDER_SUBMIT_REJECTED:               
                console.getOut().println()(sdf.format(message.getCreationTime()) + " - " + anOrder.getLabel() + ": " + message);
                break;
   
            case ORDER_FILL_REJECTED:
                console.getOut().println()(sdf.format(message.getCreationTime()) + " - " + anOrder.getLabel() + ": " + message);
                break;
   
            case ORDER_FILL_OK:

                break;

            case ORDER_CLOSE_OK:
                if (message.getReasons().contains(IMessage.Reason.ORDER_CLOSED_BY_SL)) {

                }
                else if (message.getReasons().contains(IMessage.Reason.ORDER_CLOSED_BY_TP)) {

                }
                else if (message.getReasons().contains(IMessage.Reason.ORDER_CLOSED_BY_MERGE)) {

                }
                break;

            default:
                break;
        }
    }


 

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