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