use of org.ta4j.core.trading.rules.IsFallingRule in project crypto-bot by jnidzwetzki.
the class DonchianChannelStrategy method getStrategy.
@Override
public Strategy getStrategy() {
final MACDIndicator macd = new MACDIndicator(closePriceIndicator, 9, 26);
final EMAIndicator emaMacd = new EMAIndicator(macd, 9);
final Rule buyingRule = new AndRule(new IsRisingRule(donchianChannelUpper, 1), new OverIndicatorRule(macd, Decimal.valueOf(0)));
final // new OrRule(
Rule sellingRule = new IsFallingRule(donchianChannelLower, 1);
// new UnderIndicatorRule(macd, emaMacd));
final BaseStrategy strategy = new BaseStrategy(buyingRule, sellingRule);
return strategy;
}
use of org.ta4j.core.trading.rules.IsFallingRule in project ta4j by ta4j.
the class ConvergenceDivergenceIndicator method calculatePositiveDivergenceStrict.
/**
* @param index the actual index
* @return true, if positive divergent
*/
private Boolean calculatePositiveDivergenceStrict(int index) {
Rule refIsRising = new IsRisingRule(ref, timeFrame);
Rule otherIsFalling = new IsFallingRule(ref, timeFrame);
return (refIsRising.and(otherIsFalling)).isSatisfied(index);
}
use of org.ta4j.core.trading.rules.IsFallingRule in project ta4j by ta4j.
the class ConvergenceDivergenceIndicator method calculateNegativeConvergenceStrict.
/**
* @param index the actual index
* @return true, if strict negative convergent
*/
private Boolean calculateNegativeConvergenceStrict(int index) {
Rule refIsFalling = new IsFallingRule(ref, timeFrame);
Rule otherIsFalling = new IsFallingRule(ref, timeFrame);
return (refIsFalling.and(otherIsFalling)).isSatisfied(index);
}
use of org.ta4j.core.trading.rules.IsFallingRule in project ta4j by ta4j.
the class ConvergenceDivergenceIndicator method calculateNegativeDivergenceStrict.
/**
* @param index the actual index
* @return true, if negative divergent
*/
private Boolean calculateNegativeDivergenceStrict(int index) {
Rule refIsFalling = new IsFallingRule(ref, timeFrame);
Rule otherIsRising = new IsRisingRule(ref, timeFrame);
return (refIsFalling.and(otherIsRising)).isSatisfied(index);
}
Aggregations