Portfolio123 offers three options for estimating the transaction costs for a more realistic simulation.
Advanced Slippage
Portfolio123’s Advanced Slippage is based on the square root impact model. It estimates realistic transaction costs using two components.
Slippage% = (K) * Impact% + (L) * Spread%
Impact% = Volatility * Sqrt(AbsTradeAmount / Liquidity)
Volatility = 20 day standard deviation of log returns
AbsTradeAmount = TradePrice * Abs(TradeShares)
Liquidity = MedianDailyTot(20)
Spread% = Median((Ask[i] - Bid[i]) / Close[i]) i=0..9
Limit value of Spread% = 30%
Before 2004 the fallback calculation is used due to unreliable bid/ask data
Calibration Constants
K: for empirically adjusting the Impact effect on costs. Default is 2.0
L: for empirically adjusting bid/ask spread effect on costs. Default is 0.5
Fallbacks
When Liquidity is N/A
Estimate based on MktCap in a linear and proportional fashion
Liquidity = 0.50% of Market Cap * 1M
When Spread% is N/A
Estimate based on Liquidity in a non linear and inversely proportional fashion. Raising to a negative value reverses the direction: higher liquidity corresponds to lower spreads.
Spread% = Pow(Liquidity, -0.4)
If Spread% is N/A
Spread% = 30%When Volatility or Liquidity is N/A
Impact is set to a very high value so that problems become obvious and do not go unnoticed.
Impact% = 200%
Variable Slippage
First, The "base" slippage is computed as 1% divided by Price in USD. For example, a stock that trades at $20 will have a base slippage of 0.05% (1/20), one that trades at $5 will have a base slippage of 0.2% (1/5), and one that trade for 1 penny will have a base slippage of 100% (1/0.01).
Next, "liquidity" slippage is calculated as follows:
Liquidity is calculated from the 10-day average daily amount traded (volume * price), and slippage is set according to these liquidity ranges:
Liquidity | Variable Slippage |
Up to $50,000 | 5.00% |
$50,001 to $100,000 | 1.50% |
$100.001 to $350,000 | 0.75% |
$350,001 to $1,000,000 | 0.50% |
$1,000,001 to $5,000,000 | 0.25% |
$5,000,001 or higher | 0.10% |
Finally, "total" slippage is calculated as "base" slippage + "liquidity" slippage
NOTES
The liquidity ranges apply for strategies in USD. For CAD, divide them by 0.8. For EUR, GBP, and CHF, divide them by 1.25.
ETF systems use a constant 0.10%; they are liquid by design, so we penalize them minimally. As a practical matter, the expert stock models we make available on this site have rules that eliminate stocks in the lower-liquidity categories.
Fixed Slippage
Fixed % amount is deducted based on the transaction amount.
Slippage Functions
You can use these functions in buy/sell rules, ranking and screening.
SlippageAdv( amount [, spread = 0.5, impact = 2.0, offset = 0, bars = 20])
Calculates the advanced slippage based on an amount being traded. You can use if for ranking, screening or to fine tune the constants for your needs.
SlippageVar( bars )
Calculates the variable slippage. Note that in simulations variable slippage period is hard-coded to 10 bars lookback.