@Test public void testPredicateNotTriggeredEURUSD() throws Exception { Iterable<PriceTick> priceTicks = TestingPriceFactory.createPriceTicks( TestingConstants.INSTRUMENT_EURUSD_ID, Range.closed( TestingConstants.DEFAULT_START_DATE.getMillis(), TestingConstants.DEFAULT_START_DATE.plusMinutes(1).getMillis()), Range.closed(1.23101, 1.23172), 1); PriceSpikePredicate priceSpikePredicate = createPriceSpikePredicate(TestingConstants.INSTRUMENT_EURUSD_ID); for (PriceTick priceTick : priceTicks) { if (priceSpikePredicate.apply(priceTick)) { fail("Predicate triggered."); } } }
@Override public boolean apply(PriceTick priceTick) { if (barOpenTimestamp <= 0 || priceTick.getTimestamp() > barCloseTimestamp) { prepareNewBar(priceTick); return false; } final double pipsVariation = getPricePips( priceTick.getClosePriceAsk() - openPriceAsk, priceMinimalDecimalPosition); if (pipsVariation >= minimumPips && ! eventDispatched) { eventDispatched = true; return true; } return false; }
PriceSpikePredicate extends AbstractAdviserPredicate { @Override public boolean apply(PriceTick priceTick) { if (barOpenTimestamp <= 0 || priceTick.getTimestamp() > barCloseTimestamp) { prepareNewBar(priceTick); return false; } final double pipsVariation = getPricePips( priceTick.getClosePriceAsk() - openPriceAsk, priceMinimalDecimalPosition); if (pipsVariation >= minimumPips && ! eventDispatched) { eventDispatched = true; return true; } return false; } }
PriceSpikePredicate extends AbstractAdviserPredicate { @Override public boolean apply(PriceTick priceTick) { if (barOpenTimestamp <= 0 || priceTick.getTimestamp() > barCloseTimestamp) { prepareNewBar(priceTick); return false; } final double pipsVariation = getPricePips( priceTick.getClosePriceAsk() - openPriceAsk, priceMinimalDecimalPosition); if (pipsVariation >= minimumPips && ! eventDispatched) { eventDispatched = true; return true; } return false; } PriceSpikePredicate(PredicateExecutionContext predicateExecutionContext); }
PriceSpikePredicate extends AbstractAdviserPredicate { @Override public boolean apply(PriceTick priceTick) { if (barOpenTimestamp <= 0 || priceTick.getTimestamp() > barCloseTimestamp) { prepareNewBar(priceTick); return false; } final double pipsVariation = getPricePips( priceTick.getClosePriceAsk() - openPriceAsk, priceMinimalDecimalPosition); if (pipsVariation >= minimumPips && ! eventDispatched) { eventDispatched = true; return true; } return false; } PriceSpikePredicate(PredicateExecutionContext predicateExecutionContext); @Override boolean apply(PriceTick priceTick); @Override void init(); }
PriceSpikePredicate extends AbstractAdviserPredicate { @Override public boolean apply(PriceTick priceTick) { if (barOpenTimestamp <= 0 || priceTick.getTimestamp() > barCloseTimestamp) { prepareNewBar(priceTick); return false; } final double pipsVariation = getPricePips( priceTick.getClosePriceAsk() - openPriceAsk, priceMinimalDecimalPosition); if (pipsVariation >= minimumPips && ! eventDispatched) { eventDispatched = true; return true; } return false; } PriceSpikePredicate(PredicateExecutionContext predicateExecutionContext); @Override boolean apply(PriceTick priceTick); @Override void init(); static final String PROPERTY_MINIMUM_PIPS; }