Пример #1
0
 public boolean levelNeutralizedByMovement(Level level, List<Bar> barsToCheck) {
   double minPrice = 0;
   double maxPrice = 0;
   for (Bar bar : barsToCheck) {
     if (bar.openTime() > level.timeAppeared()
     // || (bar.openTime() == level.timeAppeared() && closeBid() == level.price())
     ) {
       minPrice = Math.min(bar.openBid(), bar.closeBid());
       maxPrice = Math.max(bar.openBid(), bar.closeBid());
       if (level.price() >= minPrice && level.price() <= maxPrice) {
         return true;
       }
       if (level.direction == 1 && minPrice > level.price()) {
         return true;
       }
       if (level.direction == -1 && maxPrice < level.price()) {
         return true;
       }
     }
   }
   return false;
 }
Пример #2
0
 public double closeBid() {
   if (endBar != null) {
     return endBar.closeBid();
   }
   return bid;
 }