Dukascopy
 
 
Wiki JStore Search Login

Bug?? What is these codes?
 Post subject: Bug?? What is these codes? Post rating: 0   New post Posted: Sat 06 Jul, 2013, 23:16 
User avatar

User rating: 7
Joined: Tue 28 Feb, 2012, 09:45
Posts: 45
Location: JapanJapan
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) {...}


 
 Post subject: Re: Bug?? What is these codes? Post rating: 0   New post Posted: Mon 08 Jul, 2013, 08:13 
Site Administrator
User avatar

User rating:
Joined: Fri 21 Jun, 2013, 16:50
Posts: 197
Location: FranceFrance
Please provide the .vsf file that generated the code.


 
 Post subject: Re: Bug?? What is these codes? Post rating: 0   New post Posted: Mon 08 Jul, 2013, 09:14 
Visual JForex expert at Dukascopy
User avatar

User rating: 4
Joined: Fri 06 Feb, 2009, 16:34
Posts: 130
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.


 
 Post subject: Re: Bug?? What is these codes? Post rating: 0   New post Posted: Wed 10 Jul, 2013, 23:16 
User avatar

User rating: 7
Joined: Tue 28 Feb, 2012, 09:45
Posts: 45
Location: JapanJapan
Thanks...


 

Jump to:  

  © 1998-2024 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