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.

Order state immutable
 Post subject: Order state immutable Post rating: 0   New post Posted: Fri 25 Jan, 2013, 12:02 
User avatar

User rating: 1
Joined: Sat 24 Sep, 2011, 12:11
Posts: 31
Location: China,
there are certain code to setup SL price.

engine.submitOrder(getLabel(instrument), instrument, OrderCommand.BUY, amount,0, 5);
                  for (IOrder orderInMarket : engine.getOrders())
                  {
                      orderInMarket.setStopLossPrice(boll[2][boll_len]);}
            }


at first i tried to use orderCommand.PLACE_OFFER or PLACE.BID,but just found that order not trigger even where it should be.so i changed the code using BUY and SELL instead ,with a for-loop following to setup SL Price once order traded.code just shown above .

the problem is i backtested this strategy and the warning below shown up:

Strategy tester: com.dukascopy.api.JFException: Order state immutable @ Dukascopy.strategies.indicators.SMAStrategy_1.onBar(SMAStrategy_1.java:109)

below is the code i wrote with PLACE_OFFER or BID
engine.submitOrder(getLabel(instrument), this.instrument, orderCmd, this.amount*n, 0, 5, boll[2][boll_len],takeProfitPrice,goodTillTime);


 
 Post subject: Re: Order state immutable Post rating: 0   New post Posted: Fri 25 Jan, 2013, 13:00 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
You can only set stop loss if the order is in particular, state, this according to the following diagrams:
https://www.dukascopy.com/wiki/#Order_state


 

Jump to:  

  © 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