Dukascopy
 
 
Wiki JStore Search Login

JFOREX-3589 Threading
 Post subject: JFOREX-3589 Threading Post rating: 0   New post Posted: Thu 06 Jan, 2011, 02:47 

User rating: 0
Joined: Tue 15 Sep, 2009, 00:44
Posts: 20
I'm not sure how to implement a thread.

Do I need to create a separate strategy file for each thread?

Is there a complete example somewhere that illustrates this?

The wiki example does not have sufficient information for my limited knowledge of java. Any help would be appreciated. My current strategy is being overloaded with tasks and I cannot determine why. All I am doing is calculating indicators in onBar event and checking parameters in on Tick event.

----------------------------------- code from wiki
private class BuyTask implements Callable<Object>{
       private Instrument instrument;
        private double stopLossPips;       
 
       public BuyTask(Instrument instrument, double stopLossPips){
          this.instrument = instrument;
          this.stopLossPips = stopLossPips;
}
 
       public Object call() throws Exception {
          double stopLossPrice = history.getLastTick(this.instrument).getBid() - this.stopLossPips * this.instrument.getPipValue();
          return engine.submitOrder("Buy_order", this.instrument, OrderCommand.BUY, 0.001, 0, 20, stopLossPrice, 0);
       }
    }
private void buy() throws JFException{
   BuyTask task = new BuyTask(Instrument.EURUSD, 40);
   context.executeTask(task);          
}


 
 Post subject: Re: Threading Post rating: 0   New post Posted: Thu 06 Jan, 2011, 18:34 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please take a look at https://www.dukascopy.com/wiki/index.php?title=Threading


 
 Post subject: Re: Threading Post rating: 0   New post Posted: Tue 28 Feb, 2012, 17:13 

User rating: 1
Joined: Mon 27 Feb, 2012, 22:49
Posts: 119
Location: Czech Republic,
I have some questions about threading:

1) In Wiki-Threading is example with Callable thread. I used it and it seems like using maximum priority. I did some historical analysis and I need minimum priority. Higher priority I need for onTick and onBar. How can I set it?

2) Can we use “classical” class Thread? By Thread is easy to set priority.

Thanks


 
 Post subject: Re: JFOREX-3589 Threading Post rating: 0   New post Posted: Mon 12 Mar, 2012, 13:56 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
See the updated wiki article:
https://www.dukascopy.com/wiki/#Threading


 

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