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.

How can I submit a STOP order under submitOrder without slippage but with a stop loss price?
 Post subject: How can I submit a STOP order under submitOrder without slippage but with a stop loss price? Post rating: 0   New post Posted: Mon 09 Jul, 2012, 14:18 
User avatar

User rating: 0
Joined: Mon 09 Jul, 2012, 14:09
Posts: 17
Location: Ireland,
I'm trying to submit a STOP buy order that has a stop loss specified but no slippage. However, I find that even when I make slippage = 0.00 the order turns into a LIMIT order before it is filled. The Wiki documentation says that if isNaN(slippage) == true that no slippage will be applied but when I specify 0/0 as the slippage parameter I get (as I would have expected) an arithmetic exception error when the order is submitted.

How can I program a STOP entry order that will not turn into a LIMIT order? I can get rid of the slippage manually but that takes away the usefulness of being able to automate the order.


 
 Post subject: Re: How can I submit a STOP order under submitOrder without slippage but with a stop loss price? Post rating: 0   New post Posted: Tue 10 Jul, 2012, 10:55 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
See slippage description in javadocs of IEngine.submitOrder:
https://www.dukascopy.com/client/javadoc/com/dukascopy/api/IEngine.html#submitOrder(java.lang.String,%20com.dukascopy.api.Instrument,%20com.dukascopy.api.IEngine.OrderCommand,%20double,%20double,%20double)
Try:
    private IEngine engine;
    private IHistory history;
   
    @Override
    public void onStart(IContext context) throws JFException {
        engine = context.getEngine();
        history = context.getHistory();
       
        ITick tick = history.getLastTick(Instrument.EURUSD);
        try{
            engine.submitOrder("MyOrder", Instrument.EURUSD, OrderCommand.BUYSTOP, 0.01, tick.getBid() + 0.0005, Double.NaN);
        } catch (NumberFormatException e){
            //ignore, the NumberFormatException bug will get fixed with future releases
        }
    }


 

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