Modeling Trading Costs and Conservative Fills in Backtests
Summary
The document discusses how to represent brokerage fees, bid-ask effects, and slippage when simulating daily stock trades without quote data. It argues that a single relative transaction-cost rate cannot be assumed realistic across all situations: costs vary with asset type, market period, trading time, order size, and broker terms. A closing-price assumption also implies a particular execution process, such as a market-on-close order, and actual fills may differ from the official close.
Suggested approaches include modeling broker-specific fee schedules, adjusting simulated prices for slippage, and testing how varying slippage affects strategy performance. Another answer proposes conservative fills using adverse prices within the available bar, while noting the coarser data limitation when only daily prices are available. These are practical modeling suggestions rather than measured estimates for the specified stocks and historical period. The document provides no empirically supported universal cost rate, so assumptions should be justified against the strategy’s instruments, order sizes, and execution conditions.
Key ideas
- Transaction costs depend on the asset, period, timing, order size, and broker terms.
- A universal percentage is not a reliable estimate of trading costs across strategies.
- Closing-price simulations should account for the execution method and possible fill differences.
- Broker fees and slippage can be modeled separately and varied to assess strategy sensitivity.
- Adverse price assumptions can make fills more conservative when intraday data is unavailable.
Tags
Full text
# How to account for transaction costs in a simulated market environment? # How to account for transaction costs in a simulated market environment? I am simulating a market for my trading system. I have no ask-bid prices in my dataset and use adjusted close for both buy and sell price. To account for this I plan to use a relative transaction cost. The question is how large such a relative transaction cost should be to be realistic? - I trade stocks only from Dow Jones Industrial average (read that it might be around 0.2% in this paper) - I trade only on day-to-day (no intraday) thus I can assume to buy at close prices (adjusted close?) - I simulate trades in the time period 2000-2012 - By transaction cost I am interested in any cost related to a real trade, e.g., brokerage fee, spread, slippage (thanks @chrisaycock) ## Answer by SRKX (score 9, accepted) https://quant.stackexchange.com/a/3574 We cannot give you a relative bid-ask spread that would make sense. The reason for that is that it really depends on several parameters: - The type of financial asset you invest in (futures, funds, index, options, ...) - The period during which you're trading (I think the liquidity in markets hasn't been the same over time). - If you trade intraday, it depends on the time you trade at. - If you assume you trade close price, you would submit MOC (market on close) orders. Your broker is most likely to be able to sometimes execute your orders at a better price than the close, and sometimes the opposite. I think that some brokers will have some terms that allow you to make sure that your trade will be exactly the close price, I've seen this for some commodity futures. Finally, bid-ask spreads are not transaction cost per-say; they are the market price of liquidity in a sense. Your transaction costs would be more a fee that is charged by the broker for executing the order. It depends more on the quantity you trade and the terms you manage to negotiate with your broker. ## Answer by Ed Barsano (score 4) https://quant.stackexchange.com/a/3585 When I simulate, I can usually narrow my trades down to the minute. So I set my Open price at the HIGHEST price for the minute, and my close price to the LOWEST price for the minute. The goals is to be as conservative as possible. You don't want to go live and find that you were too optimistic in your fills. If you cannot narrow it down to smaller than a day, then your open should be at the highest price of the day, and the close at the lowest price of the day. Like I stated above, simulating should be as conservative as possible. As there will be enough real-time surprises when you start trading live. ## Answer by Autowealth (score 3) https://quant.stackexchange.com/a/4441 For the brokerage fee, consider coding a system that calculates the fees for several brokerages (so that you can compare brokerages). For the slippage (and other issues), consider coding that in as well. Adjust prices based on the slippage percentage. Once you do that, you can vary the slippage and determine how much slippage will break your algo.
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.