Why do I get an
The method remove(String) in the type IChart is not applicable for the
arguments (IShortLineChartObject)
when trying to remove a chart object?
package jforex;
import java.util.*;
import com.dukascopy.api.*;
import com.dukascopy.api.drawings.*;
public class StrategyTest implements IStrategy {
private IEngine engine;
private IConsole console;
private IHistory history;
private IContext context;
private IIndicators indicators;
private IUserInterface userInterface;
private IShortLineChartObject askLine; // askLine line
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();
IChart chart = context.getChart(Instrument.EURUSD);
if (chart != null){
askLine = chart.getChartObjectFactory().createShortLine();
}
}
public void onAccount(IAccount account) throws JFException {
}
public void onMessage(IMessage message) throws JFException {
}
public void onStop() throws JFException {
IChart chart = context.getChart(Instrument.EURUSD);
try {
chart.remove(askLine);
} catch (Exception e)
{}
}
public void onTick(Instrument instrument, ITick tick) throws JFException {
if ( instrument == Instrument.EURUSD )
{
IChart chart = context.getChart(Instrument.EURUSD);
if (chart != null){
long period = chart.getSelectedPeriod().getInterval();
if ( period == -1)
{
period = 2000;
}
askLine.setPrice(0, tick.getAsk());
askLine.setPrice(1, tick.getAsk());
askLine.setTime(0, (long) (tick.getTime()));
askLine.setTime(1, (long) (tick.getTime() + period));
}
}
}
public void onBar(Instrument instrument, Period period, IBar askBar,
IBar bidBar) throws JFException {
}
}