@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