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.

Strategy Remote Server on LIVE updates
 Post subject: Strategy Remote Server on LIVE updates Post rating: 0   New post Posted: Thu 10 Oct, 2013, 15:17 

User rating: 0
Joined: Thu 01 Nov, 2012, 17:40
Posts: 7
Hello everyone!

Today I've received a mail:
Quote:
Dear Trader,

Please be aware that we will update Strategy Remote Server on LIVE on October 14.

The new version includes an important change in the subscription engine that can become essential for your strategy. The old remote server used to subscribed strategies to the same currency pairs that are active in the trading platform at the moment when the strategy is started. As of the new update, the remote server will no longer automatically subscribe a strategy to active currency pairs.

The subscription to the live feed has to be implemented in the strategy source code (for example in onStart method). The example code snippet is shown on our wiki page.

Please note that the update will not affect the running strategies but rather those strategies that will be restarted on the server. Hence, it may be important to update your strategy in advance in order to avoid situations when your strategy is running without any feed subscriptions.


Could you please make a simple example of strategy with this change?
Or simply edit strategy example in wiki https://www.dukascopy.com/wiki/#Simple_Strategy

Thank you in advance!


 
The Best Answer  Post subject: Re: Strategy Remote Server on LIVE updates Post rating: 4   New post Posted: Thu 10 Oct, 2013, 16:25 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
   @Configurable("Instrument")
   public Instrument selectedInstrument = Instrument.EURUSD; // changed/selected before onStart

   Set<Instrument> subscribedInstruments = new HashSet<Instrument>(); // my subscribed instruments
   


Then in your onStart, put code similar to this:

      subscribedInstruments.add(selectedInstrument); // just my instrument
      context.setSubscribedInstruments(subscribedInstruments, true);



In your onTick or onBar, you reject any possible instruments you're not interested to
process, of course, as usual. But here we just check whether it is in the subscribedInstruments
Set.

(The reason the Live Server is being updated, is that it automatically subscribes you to a few
instruments, ones which your account might be "interested in". But this creates an unnecessary
loading on the Live Server, when onTick, onBar callbacks occur for instruments which
your strategy may not specifically be interested to process. Once the change is made, unless
you specifically subscribe to instruments, presumably, you won't get any onTick, onBar callbacks
at all by default. So... it has always been recommended that you do things this way as a "best practice").

I'll just show the onTick example here:

      if ( !subscribedInstruments.contains(instrument)) return; // not interested


Hope this helps !
HyperScalper


 

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