Cost of liquidation should include
- the explicit costs: fees (brokers, exchanges, give-up, post trading, etc)
- the implicit costs that you cannot know for sure a priori. They are themselves made of
- slippage: linear costs mostly, a function of the bid ask spread. If you use a dumb trading algo, you will pay a full bid-ask spread, you are right. But if you use an algo that is a little smarter (for instance succeeding in being liquidity provider --ie in the book-- part of the time) you will pay less
- and the market impact
Formulas are explained in Market microstructure in practice, but in short you need a market impact of the shape
$$\eta(q) = a \,\psi + \kappa\,\sigma\sqrt{\frac{q}{\bar V}}$$
where $q$ is your traded quantity, $\psi$ the bid-ask spread, $\sigma$ the volatility, $\bar V$ the average daily volume, and $a$ and $\kappa$ are parameters you need to fit on your data. It is important to use your own data because it will capture your trading habits (types of algo you use --see Chap 3 of the book-- for instance).