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();
context.setSubscribedInstruments(java.util.Collections.singleton(feedDescriptor.getInstrument()), true);
context.subscribeToFeed(feedDescriptor, this);
IChart chart = context.openChart(feedDescriptor);
chart.add(indicators.getIndicator("MAMA"), new Object[] { 0.1,0.01 });
}
public void onFeedData(IFeedDescriptor feedDescriptor, ITimedData feedData) {
try {
console.getOut().println(feedDescriptor);
double[] Mama = indicators.mama(feedDescriptor, AppliedPrice.CLOSE, feedDescriptor.getOfferSide(), 0.1, 0.01).calculate(1);
console.getOut().format("fast=%.5f slow=%.5f",
Mama[0], Mama[1]).println();
}
catch (Exception e) {
console.getErr().println(e);
e.printStackTrace();
}
}
The results of the MAMA indicator calculations do not correspont to the chart values. I know, that there is not enough history data in the feed, because if i set parameters to "0.8,0.7" it calculates properly. I tried using "history.readFeedData", loaded 30 days of history for M15 period, but results were the same. I guess i should calculate MAMA on array, but is there any way to use feeds for mama calculations?