The formula is more complicated than this. Services such as shapeshift.io guarantee the price for 10 minutes, as well as sending purchased tokens almost instantaneously. To accomplish this means keeping inventory and becoming vulnerable to volatility risk and liquidity risk.
Picking a reasonable bid-ask spread is hard, and probably involves more input factors than the 4 you listed above.
Picking a reasonable bid-ask spread is hard, and probably involves more input factors than the 4 you listed above.