| | |
| | | * 止损比例=1%, 止盈比例=2% |
| | | */ |
| | | public MacdMaStrategy() { |
| | | this(5, 10, 9, 20, new BigDecimal("0.01"), new BigDecimal("0.02")); |
| | | this(12, 26, 9, 20, new BigDecimal("0.01"), new BigDecimal("0.02")); |
| | | } |
| | | |
| | | /** |
| | |
| | | PriceData previous = macdData.get(macdData.size() - 2); |
| | | |
| | | // 金叉判断:DIF从下往上穿过DEA |
| | | return previous.getDif().compareTo(previous.getDea()) <= 0 && |
| | | return previous.getDif().compareTo(previous.getDea()) < 0 && |
| | | latest.getDif().compareTo(latest.getDea()) > 0; |
| | | } |
| | | |
| | |
| | | PriceData previous = macdData.get(macdData.size() - 2); |
| | | |
| | | // 死叉判断:DIF从上往下穿过DEA |
| | | return previous.getDif().compareTo(previous.getDea()) >= 0 && |
| | | return previous.getDif().compareTo(previous.getDea()) > 0 && |
| | | latest.getDif().compareTo(latest.getDea()) < 0; |
| | | } |
| | | |
| | |
| | | latest.getMacdHist().compareTo(BigDecimal.ZERO) < 0; |
| | | } |
| | | |
| | | } |
| | | } |