What u mean by comparing to reverse order? if in ex theres BIDS: 3570 3578 XXX ASK 3600 3620 3700. How you can filter out if XXX is 2750 or 5000? Currently trying range: 3578 < XXX < 3600 but not works every time especialy if the 3600 is also "ghost" ask..

1. Sort bids + asks by price. Then if XXX=2750 it gets sorted down the list, which basically means that it'll be ignored. Depends on what you do with the list of course.
2. If highest bid >= lowest ask I simulate order execution. I. e. I compare amounts and subtract one from the other, removing the one with the smaller amount from the list. Repeat until highest bid < lowest ask.