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.

Set stop loss price bug
 Post subject: Set stop loss price bug Post rating: 0   New post Posted: Tue 21 Feb, 2017, 17:14 
User avatar

User rating: 11
Joined: Tue 27 Mar, 2012, 17:47
Posts: 111
Location: GermanyGermany
Hello Support,

consider this strategy:
public class API_Bug implements IStrategy {

            @Override
            public void onStart(final IContext context) throws JFException {
                final IOrder order = context
                    .getEngine()
                    .submitOrder("APIBug", Instrument.EURUSD, OrderCommand.BUY, 0.001);

                order.waitForUpdate(IOrder.State.FILLED);
                order.setStopLossPrice(1.04721, OfferSide.ASK, -1);
            }

            @Override
            public void onTick(final Instrument instrument, final ITick tick) throws JFException {
                // TODO Auto-generated method stub

            }

            @Override
            public void onBar(final Instrument instrument, final Period period, final IBar askBar,
                              final IBar bidBar) throws JFException {
                // TODO Auto-generated method stub

            }

            @Override
            public void onMessage(final IMessage message) throws JFException {
                // TODO Auto-generated method stub

            }

            @Override
            public void onAccount(final IAccount account) throws JFException {
                // TODO Auto-generated method stub

            }

            @Override
            public void onStop() throws JFException {
                // TODO Auto-generated method stub

            }
        }


According to https://www.dukascopy.com/client/javadoc/com/dukascopy/api/IOrder.html#setStopLossPrice(double,%20com.dukascopy.api.OfferSide,%20double) a negative trailing step should result in setting the stop loss normally.
Quote from there "trailingStep - if < 0 then adds stop loss order without trailing step. Should be 0 or >= 10"
The strategy above sets a negative trailing step and a JFException is thrown with: "Exception thrown while running onStart method: Trailing step must be >= 10 or equals to 0 (cancel)"


So either the description is wrong or misleading, or this is a bug in the API.
Please fix this.
I'm using API version 2.13.30 and DDS2-jClient-JForex:3.1.2

Thx,
Juergen


 
 Post subject: Re: Set stop loss price bug Post rating: 0   New post Posted: Tue 07 Mar, 2017, 14:43 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
The comment is misleading. It should say: "if == 0 then adds stop loss order without trailing step. Should be 0 or >= 10"


 

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