Hello Support,
could you show me how one can draw arbitrary values (connected with a line) into a tick chart window and a subwindow of the same chart?
Consider this example where the comments explain what I want to achieve:
package jforex;
import java.util.Random;
import com.dukascopy.api.IAccount;
import com.dukascopy.api.IBar;
import com.dukascopy.api.IConsole;
import com.dukascopy.api.IContext;
import com.dukascopy.api.IEngine;
import com.dukascopy.api.IHistory;
import com.dukascopy.api.IIndicators;
import com.dukascopy.api.IMessage;
import com.dukascopy.api.IStrategy;
import com.dukascopy.api.ITick;
import com.dukascopy.api.IUserInterface;
import com.dukascopy.api.Instrument;
import com.dukascopy.api.JFException;
import com.dukascopy.api.Period;
public class MyStrategy implements IStrategy {
private IEngine engine;
private IConsole console;
private IHistory history;
private IContext context;
private IIndicators indicators;
private IUserInterface userInterface;
final Random rnd = new Random();
@Override
public void onStart(final 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();
// Must be something done here to attach to the EURUSD chart?
}
@Override
public void onAccount(final IAccount account) throws JFException {
}
@Override
public void onMessage(final IMessage message) throws JFException {
}
@Override
public void onStop() throws JFException {
}
@Override
public void onTick(final Instrument instrument, final ITick tick) throws JFException {
if (instrument == Instrument.EURUSD) {
final double valueForChart = rnd.nextDouble();
final double valueForSubwindow = rnd.nextDouble();
// Plot valueForChart onto the EURUSD tick chart and connect with a line???
// Plot valueForSubwindow onto a subwindow of the EURUSD tick chart and connect with a line???
}
}
@Override
public void onBar(final Instrument instrument, final Period period, final IBar askBar, final IBar bidBar) throws JFException {
}
}
I do not need an indicator since the values are
already computed.
Is there a simple way to do this?
Can you show me a working example?
Thanks for help,
Juergen