Dukascopy
 
 
Wiki JStore Search Login

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

    Submit JForex API bug reports in this forum only.
    Submit Converter issues in Converter Issues.
    Off topics are strictly forbidden.

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

Problem with Cancel StopLoss, TakeProfit and PendingOrders
 Post subject: Problem with Cancel StopLoss, TakeProfit and PendingOrders Post rating: 0   New post Posted: Mon 14 Apr, 2014, 11:47 
User avatar

User rating: 0
Joined: Wed 29 May, 2013, 04:14
Posts: 62
Two weeks ago my application stand-alone worked very well, I could cancel StopLoss, TakeProfit for Order Position and Pending Orders... I could also cancel Pending Orders...

Today I have noticed that nothing doesn't work. I can't cancel my StopLoss (ord.setStopLoss(0) doesn' t works), my TakeProfit (ord.setTakeProfitPrice(0) doesn' t works) for Order Position and Pending Order.
I can't cancel my Pending Orders...

I don't know why. My lib is ok.. Any error message...
This is my code for SL:


            for(IOrder ord : engine.getOrders()) {
                if(ord.getState() == IOrder.State.OPENED) {//if Pending Order
                    if(ord.getId().equals(frame.getPnlOrdersIDCancelStopLossPendingOrd())){//if the order corresponds
                        System.out.println("ord Id to cancel stopLoss  "+ord.getId()+"\n frame.getPnlOrdersIDCancelStopLossPendingOrd() "+frame.getPnlOrdersIDCancelStopLossPendingOrd());
                            try {
                                System.out.println("I try to cancel");
                                ord.setStopLossPrice(0);
                            } catch (JFException e) {
                                System.out.println("JFException "+e);
                                e.printStackTrace();
                            }                         
                    }
                }//if(ord.getState() == IOrder.State.OPENED) { 
            }//for(IOrder ord : engine.getOrders()) {



why did it work before and doesn't it now work?
Please show me as to write the code...


 
 Post subject: Re: Problem with Cancel StopLoss, TakeProfit and PendingOrders Post rating: 1   New post Posted: Mon 14 Apr, 2014, 12:33 
User avatar

User rating: 7
Joined: Thu 05 Sep, 2013, 12:43
Posts: 56
Location: Russian Federation, Tomsk
I have the same problem: pending orders not canceled.

Here is test code:
public void onStart(IContext context) throws JFException {
        this.engine = context.getEngine();
        this.console = context.getConsole();
        this.history = context.getHistory();
        this.context = context;
       
        Instrument instrument = Instrument.EURUSD;
        context.setSubscribedInstruments(new HashSet<Instrument>(Arrays.asList(new Instrument[] { instrument })), true);
        double price = history.getLastTick(instrument).getAsk() + 10.0*instrument.getPipValue();
        IOrder order = engine.submitOrder("newLabel", instrument, IEngine.OrderCommand.BUYSTOP, 0.01, price);
        order.waitForUpdate(IOrder.State.OPENED);
        console.getOut().println("order BUYSTOP was opened");
        order.close();
        order.waitForUpdate(IOrder.State.CANCELED);
        console.getOut().println("order BUYSTOP was canceled");
    }

I see "order BUYSTOP was opened" message but I don't see "order BUYSTOP was canceled". And order not canceled.
This is logs from remote run

Image

As you can see, strategy stopped by init timeout 300 sec.

JForex platform 2.34.1
JForex API 2.9.8


Attachments:
CancelOrderBug.java [1.48 KiB]
Downloaded 108 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: Problem with Cancel StopLoss, TakeProfit and PendingOrders Post rating: 0   New post Posted: Mon 14 Apr, 2014, 15:22 
User avatar

User rating: 21
Joined: Thu 19 May, 2011, 20:50
Posts: 413
Location: Germany, Munich
I have the same problem, bids and offers are not cancelled by a strategy

In messages JForex writes that the pending order is cancelled, but it is not
Image
Image

seen in JForex 2.34.1 DEMO

This is a heavy bug again.
You still produce any kind of updates and nobody has a chance to start the old version anymore, specially when there are bugs in the new version.
This is a dangerous deadlock for our customers!

If a new version is compulsory, why can't you send BETAs to developers and other testers first, so we can approve a version and we will all save lots of work and discussions?

My urgent demand
JForex LIVE = JForex DEMO = stable and tested version
JForex BETA = testing environment


Attachments:
pic2.png [43.2 KiB]
Downloaded 427 times
pic1.png [33.22 KiB]
Downloaded 451 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: Problem with Cancel StopLoss, TakeProfit and PendingOrders Post rating: 0   New post Posted: Mon 14 Apr, 2014, 15:35 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We managed to replicate this, we are going to fix this as soon as possible.


 
 Post subject: Re: Problem with Cancel StopLoss, TakeProfit and PendingOrders Post rating: 0   New post Posted: Mon 14 Apr, 2014, 16:23 
User avatar

User rating: 7
Joined: Thu 05 Sep, 2013, 12:43
Posts: 56
Location: Russian Federation, Tomsk
Now all working well, thanks.


 
 Post subject: Re: Problem with Cancel StopLoss, TakeProfit and PendingOrders Post rating: 0   New post Posted: Mon 14 Apr, 2014, 18:11 
User avatar

User rating: 0
Joined: Wed 29 May, 2013, 04:14
Posts: 62
Thanks a lot!!!
Now all work fine!!!


 

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