Hello
When I subscribe the feed with custom period (like a 2 minutes) and check this Strategy in Historical Tester then I never recieve the currently formed bar.
The same strategy work like a harm outside the Historical Tester

.
Expected result: not-empty IBar object
import com.dukascopy.api.*;
import com.dukascopy.api.feed.IFeedDescriptor;
import com.dukascopy.api.feed.util.TimePeriodAggregationFeedDescriptor;
import com.dukascopy.api.feed.IFeedListener;
public class ExampleStrategy implements IStrategy {
private IEngine engine;
private IConsole console;
private IHistory history;
private IContext context;
private IIndicators indicators;
private IUserInterface userInterface;
@Override
public void onStart(IContext context) throws JFException {
this.engine = context.getEngine();
this.console = context.getConsole();
this.history = context.getHistory();
this.context = context;
this.indicators = context.getIndicators();
this.userInterface = context.getUserInterface();
// Test custom feed subscribtion
Period customPeriod = Period.createCustomPeriod( Unit.Minute, 2 );
IFeedDescriptor myFeed = new TimePeriodAggregationFeedDescriptor( Instrument.EURUSD, customPeriod, OfferSide.BID );
context.subscribeToFeed(myFeed, new IFeedListener() {
@Override
public void onFeedData(IFeedDescriptor feedDescriptor, ITimedData feedData) {
// do nothing
}
});
// Waiting for the current bar (I use the subscribed feed with custom period)
while( context.getHistory().getBar(myFeed.getInstrument(), myFeed.getPeriod(), myFeed.getOfferSide(), 0) == null ) {
int waiting = 1;
}
// Expected result: not-empty IBar object
console.getOut().println(context.getHistory().getBar(myFeed.getInstrument(), myFeed.getPeriod(), myFeed.getOfferSide(), 0));
}
@Override
public void onAccount(IAccount account) throws JFException {
}
@Override
public void onMessage(IMessage message) throws JFException {
}
@Override
public void onStop() throws JFException {
}
@Override
public void onTick(Instrument instrument, ITick tick) throws JFException {
}
@Override
public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
}
}