CriticalSection wrote:
this.chart.getFeedDescriptor().setInstrument(this.chartFeed.getInstrument());
this.chart.getFeedDescriptor().setPeriod(this.chartFeed.getPeriod());
this.chart.getFeedDescriptor().setOfferSide(this.chartFeed.getOfferSide());
Thank's for Your answer. I modify the code:
public class MyStrategy implements IStrategy, IFeedListener {
//...
@Override
public void onStart(IContext context) throws JFException {
this.chart = context.getLastActiveChart();
// Create a new feed
//this.chartFeed = new TimePeriodAggregationFeedDescriptor(this.instrument, Period.TWENTY_SECS, this.chartFeed.getOfferSide()); // removed - it is unnecessary now
//context.subscribeToFeed(this.chartFeed, this); // removed - it is unnecessary now
// Change a feed period in active chart
this.chart.getFeedDescriptor().setPeriod(Period.TWENTY_SECS); //new line
this.chart.repaint();
}
//...
}
And now I have a another problem - the chart isn't refreshed/repainted after period was changed (I test it only in the strategy tester, in visual mode because Today the market is closed;) ).
How can I do it (repaint the chart)?