Filter Ticks Bars

onBar and onTick events are triggered for every subscribed instrument and period. Use the similar code to filter bars and ticks by period and instrument:

public void onTick(Instrument instrument, ITick tick) throws JFException {
    if (!instrument.equals(Instrument.EURUSD)) return; //filter EUR/USD ticks
}       
public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar)throws JFException {
    if (!instrument.equals(Instrument.EURUSD) || !period.equals(Period.ONE_HOUR)) return; //filter ONE_HOUR EUR/USD bars
}
The information on this web site is provided only as general information, which may be incomplete or outdated. Click here for full disclaimer.