OK, your claims were driving me crazy so I hacked this strategy together.
In the Visual tester, I selected only instrument EUR/USD and that was the ONLY chart which was created. If you use this approach, I think you'll get the "internal" data you want, but only the chart you are interested in.
But, when running this, as you can see, if all are selected, then the Strategy subscribes to all of the specified instruments. (This is only a hacked together example, so you would have to do whatever you need in your own processing, maybe not on ticks, but bars or whatever you do.)
ONE REQUIREMENT may be to make sure the
context.setSubscribedInstruments(subscribedInstruments, true); // lock or wait flag
use the "lock" flag is true.
As you can see further down, all of the subscribed instruments provide mixed onTick data,
but only the single chart instrument selected in the Historical Tester is displayed.
In the code below, the "tradedInstrument" variable should be the ONLY chart you ask
the Historical Tester to show. That's the only instrument you need to check when starting
the backtesting run.
IT IS NOT NECESSARY TO SPECIFY ANY INSTRUMENT TO THE HISTORICAL TESTER
UNLESS YOU WANT IT TO DISPLAY THAT CHART. The "internal" instruments' data you want
are requested inside the Strategy code, as you can see.
I ran this under the JForex Live platform historical tester
FXDD ver2.24.17.2 API ver2.7.9.5, while it was doing other things like
trading live, etc. I almost never use DEMO, so I really haven't tested it
in the DEMO version.
So you have all of your "internal" instruments available for processing, but only the
single chart you want which presumably would be where your trading stuff appears.
In my opinion, this is exactly what the Historical Tester should do, and it does it correctly.
HyperScalper
package com.fs.strategy;
import java.util.HashSet;
import java.util.Set;
import com.dukascopy.api.Configurable;
import com.dukascopy.api.IAccount;
import com.dukascopy.api.IBar;
import com.dukascopy.api.IContext;
import com.dukascopy.api.IMessage;
import com.dukascopy.api.IStrategy;
import com.dukascopy.api.ITick;
import com.dukascopy.api.Instrument;
import com.dukascopy.api.JFException;
import com.dukascopy.api.Period;
public class MultiCurrencyInternalCalcs implements IStrategy {
final Set<Instrument> subscribedInstruments = new HashSet<Instrument>();
@Configurable("Single Instrument to Trade")
public Instrument tradedInstrument = Instrument.EURUSD;
@Configurable("also Use EUR/GBP")
public boolean useEURGBP = false;
@Configurable("also Use EUR/USD")
public boolean useEURUSD = false;
@Configurable("also Use AUD/USD")
public boolean useAUDUSD = false;
@Configurable("also Use NZD/USD")
public boolean useNZDUSD = false;
IContext context;
@Override
public void onStart(IContext context) throws JFException {
this.context = context;
subscribedInstruments.add(tradedInstrument); // always this one
if (useEURGBP) subscribedInstruments.add(Instrument.EURGBP);
if (useEURUSD) subscribedInstruments.add(Instrument.EURUSD);
if (useAUDUSD) subscribedInstruments.add(Instrument.AUDUSD);
if (useNZDUSD) subscribedInstruments.add(Instrument.NZDUSD);
int count = subscribedInstruments.size();
try {
context.setSubscribedInstruments(subscribedInstruments, true); // wait
}
catch(Exception e) {
println(e.getMessage());
}
println("Subscribed instruments contains "+count+" instruments.");
for (Instrument inst : subscribedInstruments) {
println("Instrument: "+inst.toString());
}
}
private void println(final String msg) {
if (context==null) return;
context.getConsole().getOut().println(msg);
}
int dataCount = 0;
// arbitrarily stop this after receiving 1000 ticks..... demo purposes only
@Override
public void onTick(Instrument instrument, ITick tick) throws JFException {
if (!subscribedInstruments.contains(instrument)) return; // ignore
println("Tick for instrument: "+instrument.toString()+" received.");
// ok so you'd use maybe a HashMap to keep calculations for each of
// the instruments which comes through, and whatever your calculations
// are..... etc.
// BUT in the Visual Tester, only a single symbol (the one traded)
// is needed for charting purposes.
dataCount++;
if (dataCount>1000) context.stop();
return;
}
@Override
public void onBar(Instrument instrument, Period period, IBar askBar,
IBar bidBar) throws JFException {
// TODO Auto-generated method stub
}
@Override
public void onMessage(IMessage message) throws JFException {
// TODO Auto-generated method stub
}
@Override
public void onAccount(IAccount account) throws JFException {
// TODO Auto-generated method stub
}
@Override
public void onStop() throws JFException {
// TODO Auto-generated method stub
println("Strategy stopped.");
}
}
16:43:01 Strategy stopped.
16:43:01 Tick for instrument: AUD/USD received.
16:43:01 Tick for instrument: EUR/USD received.
16:43:01 Tick for instrument: NZD/USD received.
16:43:01 Tick for instrument: EUR/GBP received.
16:43:01 Tick for instrument: AUD/USD received.
16:43:01 Tick for instrument: AUD/USD received.
16:43:01 Tick for instrument: AUD/USD received.
16:43:01 Tick for instrument: NZD/USD received.
16:43:01 Tick for instrument: NZD/USD received.
16:43:01 Tick for instrument: EUR/USD received.
16:43:01 Tick for instrument: EUR/GBP received.
16:43:01 Tick for instrument: EUR/USD received.
16:43:01 Tick for instrument: NZD/USD received.
16:43:01 Tick for instrument: NZD/USD received.
16:43:01 Tick for instrument: NZD/USD received.
16:43:01 Tick for instrument: AUD/USD received.
16:43:01 Tick for instrument: AUD/USD received.
16:43:01 Tick for instrument: AUD/USD received.
16:43:01 Tick for instrument: NZD/USD received.
16:43:01 Tick for instrument: NZD/USD received.
16:43:01 Tick for instrument: AUD/USD received.
16:43:01 Tick for instrument: NZD/USD received.
16:43:01 Tick for instrument: AUD/USD received.
16:43:01 Tick for instrument: AUD/USD received.
16:43:01 Tick for instrument: AUD/USD received.
16:43:01 Tick for instrument: AUD/USD received.
16:43:01 Tick for instrument: NZD/USD received.
16:43:01 Tick for instrument: NZD/USD received.
16:43:01 Tick for instrument: AUD/USD received.
16:43:00 Tick for instrument: NZD/USD received.
16:43:00 Tick for instrument: AUD/USD received.
16:43:00 Tick for instrument: EUR/GBP received.
16:43:00 Tick for instrument: EUR/USD received.
16:43:00 Tick for instrument: AUD/USD received.
16:43:00 Tick for instrument: NZD/USD received.
16:43:00 Tick for instrument: NZD/USD received.
16:43:00 Tick for instrument: NZD/USD received.
16:43:00 Tick for instrument: AUD/USD received.
16:43:00 Tick for instrument: AUD/USD received.
16:43:00 Tick for instrument: NZD/USD received.
16:43:00 Tick for instrument: AUD/USD received.
16:43:00 Tick for instrument: NZD/USD received.
16:43:00 Tick for instrument: NZD/USD received.
16:43:00 Tick for instrument: AUD/USD received.
16:43:00 Tick for instrument: AUD/USD received.
16:43:00 Tick for instrument: AUD/USD received.
16:43:00 Tick for instrument: AUD/USD received.
16:43:00 Tick for instrument: NZD/USD received.
16:43:00 Tick for instrument: AUD/USD received.
16:43:00 Tick for instrument: NZD/USD received.
16:43:00 Tick for instrument: AUD/USD received.
16:43:00 Tick for instrument: AUD/USD received.
16:43:00 Tick for instrument: NZD/USD received.
16:43:00 Tick for instrument: NZD/USD received.
16:43:00 Tick for instrument: AUD/USD received.
16:43:00 Tick for instrument: NZD/USD received.
16:43:00 Tick for instrument: NZD/USD received.
16:43:00 Tick for instrument: AUD/USD received.
16:42:59 Tick for instrument: EUR/GBP received.
16:42:59 Tick for instrument: AUD/USD received.
16:42:59 Tick for instrument: AUD/USD received.
16:42:59 Tick for instrument: AUD/USD received.
16:42:59 Tick for instrument: EUR/GBP received.
16:42:59 Tick for instrument: AUD/USD received.
16:42:59 Tick for instrument: EUR/GBP received.
16:42:59 Tick for instrument: AUD/USD received.
16:42:59 Tick for instrument: EUR/GBP received.
16:42:59 Tick for instrument: EUR/GBP received.
16:42:59 Tick for instrument: EUR/GBP received.
16:42:59 Tick for instrument: EUR/GBP received.
16:42:59 Tick for instrument: NZD/USD received.
16:42:59 Tick for instrument: AUD/USD received.
16:42:59 Tick for instrument: AUD/USD received.
16:42:59 Tick for instrument: EUR/GBP received.
16:42:59 Tick for instrument: NZD/USD received.
16:42:59 Tick for instrument: NZD/USD received.
16:42:59 Tick for instrument: NZD/USD received.
16:42:59 Tick for instrument: EUR/GBP received.
16:42:59 Tick for instrument: EUR/USD received.
16:42:59 Tick for instrument: NZD/USD received.
16:42:59 Tick for instrument: EUR/GBP received.
16:42:59 Tick for instrument: NZD/USD received.
16:42:59 Tick for instrument: EUR/GBP received.
16:42:59 Tick for instrument: EUR/USD received.
16:42:59 Tick for instrument: EUR/USD received.
16:42:59 Tick for instrument: EUR/USD received.
16:42:59 Tick for instrument: AUD/USD received.
16:42:59 Tick for instrument: EUR/USD received.
16:42:59 Tick for instrument: EUR/GBP received.
16:42:59 Tick for instrument: NZD/USD received.
16:42:59 Tick for instrument: EUR/GBP received.
16:42:59 Tick for instrument: EUR/GBP received.
16:42:59 Tick for instrument: EUR/USD received.
16:42:59 Tick for instrument: AUD/USD received.
16:42:59 Tick for instrument: AUD/USD received.
16:42:59 Tick for instrument: EUR/USD received.
16:42:59 Tick for instrument: EUR/GBP received.
16:42:59 Tick for instrument: AUD/USD received.
16:42:59 Tick for instrument: NZD/USD received.
16:42:59 Tick for instrument: NZD/USD received.
16:42:59 Tick for instrument: AUD/USD received.
16:42:59 Tick for instrument: AUD/USD received.
16:42:58 Tick for instrument: EUR/GBP received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: AUD/USD received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: EUR/GBP received.
16:42:58 Tick for instrument: EUR/GBP received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: EUR/GBP received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: AUD/USD received.
16:42:58 Tick for instrument: NZD/USD received.
16:42:58 Tick for instrument: AUD/USD received.
16:42:58 Tick for instrument: EUR/GBP received.
16:42:58 Tick for instrument: AUD/USD received.
16:42:58 Tick for instrument: AUD/USD received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: EUR/GBP received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: AUD/USD received.
16:42:58 Tick for instrument: EUR/GBP received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: EUR/GBP received.
16:42:58 Tick for instrument: AUD/USD received.
16:42:58 Tick for instrument: AUD/USD received.
16:42:58 Tick for instrument: NZD/USD received.
16:42:58 Tick for instrument: EUR/GBP received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: EUR/GBP received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: NZD/USD received.
16:42:58 Tick for instrument: EUR/GBP received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: EUR/GBP received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: EUR/GBP received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: EUR/GBP received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: NZD/USD received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: EUR/GBP received.
16:42:58 Tick for instrument: EUR/GBP received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: EUR/GBP received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:58 Tick for instrument: AUD/USD received.
16:42:58 Tick for instrument: NZD/USD received.
16:42:58 Tick for instrument: AUD/USD received.
16:42:58 Tick for instrument: AUD/USD received.
16:42:58 Tick for instrument: NZD/USD received.
16:42:58 Tick for instrument: AUD/USD received.
16:42:58 Tick for instrument: EUR/GBP received.
16:42:58 Tick for instrument: NZD/USD received.
16:42:58 Tick for instrument: EUR/USD received.
16:42:57 Tick for instrument: EUR/GBP received.
16:42:57 Tick for instrument: AUD/USD received.
16:42:57 Tick for instrument: NZD/USD received.
16:42:57 Tick for instrument: EUR/USD received.
16:42:57 Tick for instrument: AUD/USD received.
16:42:57 Tick for instrument: EUR/USD received.
16:42:57 Tick for instrument: EUR/USD received.
16:42:57 Tick for instrument: EUR/GBP received.
16:42:57 Tick for instrument: AUD/USD received.
16:42:57 Tick for instrument: EUR/USD received.
16:42:57 Tick for instrument: EUR/GBP received.
16:42:57 Tick for instrument: NZD/USD received.
16:42:57 Tick for instrument: EUR/USD received.
16:42:57 Tick for instrument: NZD/USD received.
16:42:57 Tick for instrument: EUR/USD received.
16:42:57 Tick for instrument: AUD/USD received.
16:42:57 Tick for instrument: NZD/USD received.