Hi Attached the bones of the strategy
I just need to pick ema values for last 3 bars on renko .. then place and close orders ... thanks but would also like to be able to print stuff out in console window
Thankyou
======================================
package jforex;
import java.util.*;
import com.dukascopy.api.*;
import com.dukascopy.api.feed.*;
import com.dukascopy.api.feed.util.*;
import com.dukascopy.api.IIndicators.AppliedPrice;
import com.dukascopy.api.indicators.IIndicator;
import com.dukascopy.api.indicators.IndicatorInfo;
public class RenkoStrategy implements IStrategy {
private IEngine engine;
private IConsole console;
private IHistory history;
private IContext context;
private IIndicators indicators;
private IUserInterface userInterface;
@Configurable("Instrument 1")
public Instrument currInstrument = Instrument.EURUSD;
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();
IFeedDescriptor RenkofeedDescriptor = new RenkoFeedDescriptor(currInstrument, PriceRange.FIVE_PIPS, OfferSide.BID);
context.subscribeToFeed(RenkofeedDescriptor, new IFeedListener() {
public void onFeedData(IFeedDescriptor feedDescriptor, ITimedData feedData) {
// context.getConsole().getOut().println("range bar completed: " + " of feed: " + feedDescriptor);
try {
Object[] emaFeed0 = indicators.calculateIndicator(feedDescriptor, new OfferSide[] { OfferSide.BID }, "EMA",new AppliedPrice[] { AppliedPrice.CLOSE }, new Object[] { 13 }, 0);
Object[] emaFeed1 = indicators.calculateIndicator(feedDescriptor, new OfferSide[] { OfferSide.BID }, "EMA",new AppliedPrice[] { AppliedPrice.CLOSE }, new Object[] { 13 }, 1);
Object[] emaFeed2 = indicators.calculateIndicator(feedDescriptor, new OfferSide[] { OfferSide.BID }, "EMA",new AppliedPrice[] { AppliedPrice.CLOSE }, new Object[] { 13 }, 2);
} catch (JFException e) {
}
}
});
}
public void onAccount(IAccount account) throws JFException {
}
public void onMessage(IMessage message) throws JFException {
}
public void onStop() throws JFException {
}
public void onTick(Instrument instrument, ITick tick) throws JFException {
}
public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
}
}