How Do I make a simple script that buys all in on every tick? with stop loss 0.1 and take profit 0.1 ? This is what I tried but it is not working... it does no orders at all please help
THe point is to make as much turnover as fast as possible
package jforex.orders;
import com.dukascopy.api.*;
import com.dukascopy.api.IEngine.OrderCommand;
public class flipper implements IStrategy {
private IEngine engine;
private IConsole console;
private IOrder order;
@Override
public void onStart(IContext context) throws JFException {
IEngine engine = context.getEngine();
IHistory history = context.getHistory();
Instrument instrument = Instrument.EURUSD;
context.setSubscribedInstruments(java.util.Collections.singleton(instrument), true);
}
public void onMessage(IMessage message) throws JFException {}
public void onTick(Instrument instrument, ITick tick) throws JFException {
double sl = tick.getAsk() - instrument.getPipValue() * 0.1;
double tp = tick.getAsk() + instrument.getPipValue() * 0.1;
IOrder order = engine.submitOrder("MOI", instrument, OrderCommand.BUY, 1.0, 0, 5, sl, tp);
}
public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {}
public void onAccount(IAccount account) throws JFException {}
public void onStop() throws JFException {}}