Dukascopy
 
 
Wiki JStore Search Login

No Orders from getHistory()
 Post subject: No Orders from getHistory() Post rating: 0   New post Posted: Tue 20 Jan, 2015, 10:50 
User avatar

User rating: 0
Joined: Tue 06 Jan, 2015, 14:49
Posts: 5
Location: GermanyGermany
Hello,

i have problems to get all my closed orders in the past 3 days on my non-permanent Demo-Account and my permanent Demo-Account while using JForex-SDK Version 2.42.5. I know there must be over 100 closed orders in these accounts. I can see them in JForex-Tools by Using "Position report". Can you help me pls? Result of "context.getAccount().isGlobal()" = FALSE.

Greetings from Germany,
Emopala

Here you can see my code:
public class GetDailyOrdersStrategy implements IStrategy {
   private boolean busy = false;
   IEngine engine;
   IHistory history;


   @SuppressWarnings("static-access")
   @Override
   public void onStart(IContext context) throws JFException {
      engine = context.getEngine();
      history = context.getHistory();
      busy = true;
      IBar fromBar;
      IBar toBar;

      for (Instrument currInstrument : PerformForexSignalsV2.jforexInstruments){
         fromBar = context.getHistory().getBar(currInstrument, Period.DAILY, OfferSide.ASK, 3);
         toBar = context.getHistory().getBar(currInstrument, Period.DAILY, OfferSide.ASK, 0);
         ArrayList<IOrder> orders = (ArrayList<IOrder>)history.getOrdersHistory(
               currInstrument,
               fromBar.getTime(),
               toBar.getTime());
         System.out.println("Found " + orders.size() + " for instrument: " + currInstrument);
      }

      busy = false;

   }

   @Override
   public void onTick(Instrument instrument, ITick tick) throws JFException {

   }

   @Override
   public void onBar(Instrument instrument, Period period, IBar askBar,
         IBar bidBar) throws JFException {

   }

   @Override
   public void onMessage(IMessage message) throws JFException {

   }

   @Override
   public void onAccount(IAccount account) throws JFException {

   }

   @Override
   public void onStop() throws JFException {

   }

   public boolean isBusy() {
      return busy;
   }

   public void setBusy(boolean busy) {
      this.busy = busy;
   }

}


and here you can see my result:
Quote:
Found 0 for instrument: EUR/USD
Found 0 for instrument: USD/CHF
Found 0 for instrument: GBP/USD
Found 0 for instrument: USD/JPY
Found 0 for instrument: USD/CAD
Found 0 for instrument: AUD/USD
Found 0 for instrument: EUR/JPY
Found 0 for instrument: NZD/USD
Found 0 for instrument: GBP/CHF


 

Jump to:  

cron
  © 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