Re:
A trader when buying needs to buy at the ask price and when selling needs to sell
at the bid price. So how can a trade happen 'in between' the bid and ask?
Saying the trade can happen "in between" the bid & ask is simplistic. There is a time dimension to the market. It's more accurate to say that an order can be placed "in between" the current best bid & ask (observed at time T=0), thus establishing a new level for one or the other of those quoted prices (observed at time T>0).
If you enter a market order to buy (or sell), then yes, you'll generally be accepting the current best ask (or best bid) with your order, because that's what a market order says to do: Accept the current best market price being offered for your kind of transaction. Of course, prices may move much faster than your observation of the price and the time it takes to process your order – you're far from being the only participant.
Market orders aside, you are free to name your own price above or below the current best bid & ask, respectively.
- If you were to enter an order to sell at a price that is lower than the current best ask, or,
- If you were to enter an order to buy at a price that is higher than the current best bid,
... then one could say that you are placing an order "in between" the bid and ask at the time your order is placed. However – and this is key – you are also moving one or the other of those quoted prices in the process of placing your above-bid buy order or your below-ask sell order.
Then, only if somebody else in the market chooses to accept your new ask (or bid) does your intended transaction take place. And that transaction takes place at the new ask (or bid) price, not the old one that was current when you entered your order.
Read more about bid & ask prices at this other question:
(p.s. FWIW, I don't necessarily agree with the assertion from the article you quoted, i.e.: "By looking for trades that take place in between the bid and ask, you can tell when a strong trend is about to come to an end." I would say: Maybe, perhaps, but maybe not.)