I'm sure there is a simple answer to this but I haven't had any luck with searches. I'm just wondering when someone places a market order which order(s) from the limit order book are selected to fill that? Let's say the order book has the highest bid at 100 and the lowest ask at 101 and I place a limit order to buy at 100. I'm now bidding the same as all the other highest bids, so when market orders to sell come through get matched with highest bids, how are the bids selected? Is it random, in order by time, size, or some other mechanism?
And just in case it is by time like FIFO, let's say I placed many limit orders long in advance at prices well out of the money 99, 98, 97, etc. Could I get myself to the top of the list at all these prices that are out of the money just by placing my orders anticipating a possible drop?