Hi Support,
this is a piece of renko strategy
private IEngine engine;
private IConsole console;
private IHistory history;
private IAccount account;
private IIndicators indicators;
private int counter = 0;
private IFeedDescriptor feedDescriptor;
private IOrder order = null;
public int brickSize = 1;
public int fastMaPeriod = 50;
public MaType fastMaType = MaType.EMA;
public int slowMaPeriod = 100;
public MaType slowMaType = MaType.EMA;
@Configurable("Instrument")
public Instrument instrument = Instrument.EURUSD;
@Configurable("Offer side")
public OfferSide offerSide = OfferSide.BID;
@Configurable("Slippage")
public double slippage = 0.7;
public double amount = 0.01;
public int takeProfitPips = 40;
public int stopLossPips = 40;
@Override
public void onStart(IContext context) throws JFException {
this.console = context.getConsole();
this.indicators = context.getIndicators();
this.history = context.getHistory();
this.engine = context.getEngine();
// range bar feed
feedDescriptor = new FeedDescriptor();
feedDescriptor.setDataType(DataType.RENKO);
feedDescriptor.setOfferSide(offerSide);
feedDescriptor.setInstrument(instrument);
feedDescriptor.setPriceRange(PriceRange.valueOf(brickSize));
}
@Override
public void onTick(Instrument instrument, ITick tick) throws JFException {
if (instrument != this.instrument) {
return;
}
tickBid = tick.getBid();
if (!isActive(order)) {
order = null;
}
IRenkoBar brick = history.getRenkoBar(instrument, offerSide, PriceRange.valueOf(brickSize), 0);
IRenkoBar brickMeno1 = history.getRenkoBar(instrument, offerSide, PriceRange.valueOf(brickSize), 1);
// calculate indicator
double[] slowMAfeed = (double[]) indicators.calculateIndicator(
feedDescriptor,
new OfferSide[]{OfferSide.BID},
"MA",
new AppliedPrice[]{AppliedPrice.CLOSE},
new Object[]{slowMaPeriod, slowMaType.ordinal()},
2, brick.getTime(), 0)[0];
.....
Please, could you show how to obtain MACD-Histogram and Awesome with indicators.calculateIndicator(), like the previous example with MA ?
Best regards,
Frank