I have written a simulation that matches buy and sell orders, keeps track of an order book and simulates trades. My first pass at order submission was to generate random orders around the bid/ask spread. This does not produce a random walk in trade prices. What happens is the orders are distributed evenly but around the bid/ask spread they get traded out but beyond this they start clumping together thereby forming 'price resistance'for want of a better word. Is there an algorithm I can use that will result in a random walk for trade prices?
Analyzing this question theoretically, I think the following strategy will result in a random walk.
I do not know your strategy by detail, so I am not sure if your have considered the above items already. But by guess, it may be the first requirement that bothers you. Too many limit orders on the best-bid / best-ask seems tend to prevent market prices from change. In fact, as long as limit orders at best-bid / best-ask have the opportunity to be exhausted, the simulation strategy will generate a random walk, you just need a longer time to watch the price to walk away. Any way, it can still be called a "random walk".
You have intense academic research on orderbook dynamics simulations, just cite:
(1) is a generic survey, (2) provides you a way to build consistent simulations and different scales (i.e. controlling the volatility, the bid-ask spread and their relation along the whole day), (3) is more local but allow to simulate a consistent way the order flow dynamics and the price one.
One simple way to improve you simulations is to:
If you want to have proofs that the diffusive limit of a point process will be a Brownian motion, you can read for example: