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
Variable slippage is calculated based on the stock's liquidity. The liquidity is calculated from the 10-day average daily amount traded (volume * price), and slippage is set according to these liquidity ranges:
Daily Liquidity | Variable Slippage |
|---|---|
Up to $40,000 | 4.00% |
$40,001 – $55,000 | 3.00% |
$55,001 – $80,000 | 2.00% |
$80,001 – $125,000 | 1.25% |
$125,001 – $225,000 | 0.80% |
$225,001 – $450,000 | 0.50% |
$450,001 – $900,000 | 0.30% |
$900,001 – $2,000,000 | 0.20% |
$2,000,001 – $7,500,000 | 0.12% |
Over $7,500,000 | 0.08% |
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 as a percentage for the stock bein analyzed based on an amount being traded. You can use this function in the screener to fine tune the constants for your needs.
SlippageVar( bars )
Returns the variable slippage for the stock being examined as a percentage. Note that in simulations variable slippage period is hard-coded to 10 bars lookback.