@Test public void testValidInvertedHammerCandlestick() throws Exception { List<PriceTick> priceTicks = createPriceTicks( INSTRUMENT, DATE_RANGE, 10022.5, 10040.3, 10016.3, 10020.0); CandlestickHammerPredicate candlestickHammerPredicate = createCandlestickHammerPredicate(); for (PriceTick priceTick : priceTicks) { if (candlestickHammerPredicate.apply(priceTick)) { return; } } fail("Predicate not triggered."); }
@Override public boolean apply(PriceTick priceTick) { if (priceTick.getTimestamp() > barEndTimestamp) { if (isFirstBar) { if (barEndTimestamp > 0) { isFirstBar = false; } } else if(isHammerPattern(openPrice, closePrice, highPrice, lowPrice)) { return true; } prepareNewBar(priceTick); } updateBarValues(priceTick); return false; }
CandlestickHammerPredicate extends AbstractAdviserPredicate { @Override public boolean apply(PriceTick priceTick) { if (priceTick.getTimestamp() > barEndTimestamp) { if (isFirstBar) { if (barEndTimestamp > 0) { isFirstBar = false; } } else if(isHammerPattern(openPrice, closePrice, highPrice, lowPrice)) { return true; } prepareNewBar(priceTick); } updateBarValues(priceTick); return false; } }
CandlestickHammerPredicate extends AbstractAdviserPredicate { @Override public boolean apply(PriceTick priceTick) { if (priceTick.getTimestamp() > barEndTimestamp) { if (isFirstBar) { if (barEndTimestamp > 0) { isFirstBar = false; } } else if(isHammerPattern(openPrice, closePrice, highPrice, lowPrice)) { return true; } prepareNewBar(priceTick); } updateBarValues(priceTick); return false; } CandlestickHammerPredicate(PredicateExecutionContext predicateExecutionContext); }
CandlestickHammerPredicate extends AbstractAdviserPredicate { @Override public boolean apply(PriceTick priceTick) { if (priceTick.getTimestamp() > barEndTimestamp) { if (isFirstBar) { if (barEndTimestamp > 0) { isFirstBar = false; } } else if(isHammerPattern(openPrice, closePrice, highPrice, lowPrice)) { return true; } prepareNewBar(priceTick); } updateBarValues(priceTick); return false; } CandlestickHammerPredicate(PredicateExecutionContext predicateExecutionContext); @Override boolean apply(PriceTick priceTick); @Override void init(); }
CandlestickHammerPredicate extends AbstractAdviserPredicate { @Override public boolean apply(PriceTick priceTick) { if (priceTick.getTimestamp() > barEndTimestamp) { if (isFirstBar) { if (barEndTimestamp > 0) { isFirstBar = false; } } else if(isHammerPattern(openPrice, closePrice, highPrice, lowPrice)) { return true; } prepareNewBar(priceTick); } updateBarValues(priceTick); return false; } CandlestickHammerPredicate(PredicateExecutionContext predicateExecutionContext); @Override boolean apply(PriceTick priceTick); @Override void init(); static final String PROPERTY_TIME_FRAME; static final String PROPERTY_MINIMUM_CANDLE_SIZE; }