Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Connecting Time - Too Slow
 Post subject: Connecting Time - Too Slow Post rating: 0   New post Posted: Tue 21 Aug, 2012, 15:22 

User rating: 0
Joined: Sun 08 Jan, 2012, 10:33
Posts: 1
Location: Poland,
Hello,
When I am connecting using client.Connect() i must wait around 5 seconds to see client.IsConnected()
It is needed when i change route to backup link, but it is too slow, some ticks can be dropped


 
 Post subject: Re: Connecting Time - Too Slow Post rating: 0   New post Posted: Thu 30 Aug, 2012, 08:11 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
rafalm23 wrote:
some ticks can be dropped
The ticks are still there in the IHistory. If you find crucial the IStrategy.onTick execution on those ticks, then you can do it on the strategy start, e.g.:
public class ExecOnHistTicks implements IStrategy {

   IHistory history;
   Set<Instrument> instruments;
   long offlineFrom, offlineTo;

   public ExecOnHistTicks() {}

   public ExecOnHistTicks(Set<Instrument> instruments, long offlineFrom, long offlineTo) {
      this.offlineFrom = offlineFrom;
      this.offlineTo = offlineTo;
      this.instruments = instruments;
   }

   @Override
   public void onStart(IContext context) throws JFException {
      history = context.getHistory();
      for (Instrument instrument : instruments) {
         List<ITick> ticks = history.getTicks(instrument, offlineFrom, offlineTo);
         for (ITick tick : ticks) {
            onTick(instrument, tick);
         }
      }
   }
//..
Here, of course, you would also need to make sure that in the onTick you use history and indicator methods that use time and candle intervals, not shifted values.


Attachments:
ExecOnHistTicks.java [1.15 KiB]
Downloaded 283 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 

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