Loading ...

Jforex Non Standard Time Frame Ema Value

Hello everybody,

Few days ago I had an order for automating forex strategy for 3 minutes time frame in jForex platform.

I faced issue that by default jForex doesn't work with 3 minutes. In order to do this, the following parts were needed for addition:

@Override
public void onStart(IContext context) throws JFException {
period3Min = Period.createCustomPeriod(Unit.Minute, 3);
edDescriptor myFeed = new TimePeriodAggregationFeedDescriptor(Instrument.EURUSD, period3Min, OfferSide.ASK);
ontext.subscribeToFeed(myFeed, new IFeedListener() {@Override
pan style="color: #008800; font-weight: bold;">public void onFeedData(IFeedDescriptor feedDescriptor, ITimedData feedData) {
try {
nsole.getOut().println("finished bar: " + feedData);
console.getOut().println("current bar: " + history.getBar(feedDescriptor.getInstrument(), feedDescriptor.getPeriod(), feedDescriptor.getOfferSide(), 0));
} catch (JFException ex) {
console.getErr().println(ex.getMessage());
an style="color: #333333;">}
pan style="color: #333333;">}
pan style="color: #333333;">});

also those parts were added as import:

 

import com.dukascopy.api.Unit;

import com.dukascopy.api.feed.IFeedDescriptor;

import com.dukascopy.api.feed.util.TimePeriodAggregationFeedDescriptor;

import com.dukascopy.api.feed.IFeedListener;