Dukascopy Support Board
http://www.dukascopy.com/swiss/english/forex/jforex/forum/

Bug?? What is these codes?
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=141&t=49551
Page 1 of 1

Author:  MobNaga [ Sat 06 Jul, 2013, 23:16 ]
Post subject:  Bug?? What is these codes?

Q1:
private void updateVariables() {
        try {
            AllPositions = engine.getOrders(defaultInstrument);
            List<IOrder> listMarket = new ArrayList<IOrder>();
            for (IOrder order: AllPositions) {
                if (order.getState().equals(IOrder.State.FILLED)){
                    listMarket.add(order);
                }
            }
            List<IOrder> listPending = new ArrayList<IOrder>();
            for (IOrder order: AllPositions) {
                if (order.getState().equals(IOrder.State.OPENED)){
                    listPending.add(order);
                }
            }
            OpenPositions = listMarket;
            PendingPositions = listPending;
        } catch(JFException e) {
            e.printStackTrace();
        }
    }

Why "AllPositions = engine.getOrders(defaultInstrument);"?
Why not "AllPositions = engine.getOrders();"?

Q2:

Why this?
public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
     if (instrument.equals(defaultInstrument)) {
            LastAskCandle = new Candle(askBar, period, instrument, OfferSide.ASK);
            LastBidCandle = new Candle(bidBar, period, instrument, OfferSide.BID);
            updateVariables();
        }
    }

why not be like a this?
public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
            LastAskCandle = new Candle(askBar, period, instrument, OfferSide.ASK);
            LastBidCandle = new Candle(bidBar, period, instrument, OfferSide.BID);
            updateVariables();
    }

Who put a "instrument.equals(defaultInstrument){}"???
This line is very annoying for me.

And also, this
public void onMessage(IMessage message) throws JFException {
        if (message.getOrder() != null && message.getOrder().getInstrument().equals(defaultInstrument)) {...}

why not this.
public void onMessage(IMessage message) throws JFException {
        if (message.getOrder() != null) {...}

Author:  Bruno_Grunberg [ Mon 08 Jul, 2013, 08:13 ]
Post subject:  Re: Bug?? What is these codes?

Please provide the .vsf file that generated the code.

Author:  Visual Support [ Mon 08 Jul, 2013, 09:14 ]
Post subject:  Re: Bug?? What is these codes?

MobNaga wrote:
Q1:
Q2:

Both code sample are not bugs.
Anyway those cases are already changed and at next versions, you will see the changes.

Author:  MobNaga [ Wed 10 Jul, 2013, 23:16 ]
Post subject:  Re: Bug?? What is these codes?

Thanks...

  Page 1 of 1