Bar bar5M_0 = history.getBar(instrument, Period.FIVE_MINS, OfferSide.BID, 0); IBar bar5M_20 = history.getBar(instrument, Period.FIVE_MINS, OfferSide.BID, 20); double[] sma = indicators.ema(instrument, Period.FIVE_MINS, OfferSide.BID, AppliedPrice.CLOSE, periodIndicateur, Filter.NO_FILTER, bar5M_20.getTime(), bar5M_0.getTime()); double valeur1 =0; if(sma.length > 1) { valeur1 = Math.abs((sma[10] - sma[20])); }
But, i have really no idea how to creates indicator with this idea.
indicator : EMA of timeperiod 20
outputs : indicate the difference between 2 value of the array example array[5] - array[0] ...
Thanks for your help
|