Skip to content
All library documents

Risk-Based Position Sizing for Futures Backtests

Article Quant Q&A · Author: Elrond

Summary

The document considers how to represent margin and capital use when backtesting a long-short futures strategy. Its central guidance is that exchange margin is a minimum collateral requirement for protecting the exchange, not a sensible target for sizing positions. Using the maximum number of contracts allowed by margin can create excessive leverage, especially when positions remain open for several days.

It outlines two alternatives. Fixed-fraction sizing sets contracts from account equity and an estimated loss per contract, with the fraction chosen to tolerate a specified run of losses; the response suggests estimating the loss with value at risk over the relevant trade horizon. Kelly-style sizing instead uses the estimated distribution of gains and losses to maximize long-run growth, but its estimates are difficult to get right and may overstate a new strategy’s profitability. The author favors risk-based sizing initially. The answer does not specify a complete model for margin calls, collateral interest, or excess cash, so those parts of the original backtest question remain unresolved.

Key ideas

  • Exchange margin requirements are not a recommended position-sizing target.
  • Fixed-fraction sizing relates account equity and estimated loss per contract to the number of contracts traded.
  • Value at risk over the trade horizon is suggested as one way to estimate loss per contract.
  • Kelly-style sizing uses gain and loss distributions to target long-term growth but depends on difficult estimates.
  • The response favors risk-based sizing early in strategy development and does not fully model margin cash flows.

Tags

Full text
# Margin modelling to backtest futures investment strategy


# Margin modelling to backtest futures investment strategy












Let say that I have access to continuous daily time series for 20+ years of data for E-mini S&P 500 Index Futures. I have a long/short strategy to backtest that places orders either on open or close. The management of the margin has an impact over the performance of the backtest and I am unsure about how to model the margin.

- How to model margin calls? E.g. is it best practice to use the whole capital to buy as many contract as possible, or buy contracts using half capital and to invest the remaining half in treasury bonds to be used as collateral in case of margin calls?

- How to model interest rate on margin? E.g. is it best practice to assume no interest rate on margin or to use the 3 month t-bill rate?

- How to model margin withdrawals? E.g. is it best practice to assume to reinvest the excess on margin in new contracts whenever possible?

A potential solution for points 1 and 3 could be to assume to restore the margin to the initial margin at the end of day and to reinvest the excess liquidity in new contracts or to sell contracts when liquidity is needed to restore the margin.

The answer should target the best practices while not being too much error prone to be implemented in python and fairly representative of the historical performance.

## Answer by Alex C (score 0, accepted)

https://quant.stackexchange.com/a/34326

The amount of margin required by the exchange per futures contract is not a good guide to position sizing. It is designed to protect the exchange from your failure during a particularly bad day. Using this much leverage is too dangerous especially if your trades last many days; you will usually want to trade less than the maximum allowed number of contracts.

The trade sizing problem in futures trading is: if you have $E$ dollars in your futures trading account at time t, how many contracts should you buy/sell on your next trade.

There are broadly speaking two approaches (with many variants and intermediate cases possible):

The Fixed Fraction position sizing method due to Ralph Vince (1990), is based on risk management considerations only. You must take a position small enough that you could survive N consecutive losses without depleting your account. Vince said you estimate the worst loss per contract $L$ using historical data and then the number of contracts to trade is

$\textbf{contracts} = \frac{1}{N}\frac{E}{|L|}$

Vince recommended that the fraction $f=\frac{1}{N}$ should be set to 0.05 (i.e. $\frac{1}{20}$). Some people recommend 0.10 if you are willing to take a high level of risk. It seems reasonable to estimate $L$ using 95% ValueAtRisk over the relevant trade horizon rather than the biggest loss in your backtest.

A more advanced method of position sizing is based on the Kelly Criterion and its variants. This involves optimizing the long term rate of growth, and requires knowing the distribution of gains and losses (instead of just the biggest loss). It has the desirable property that bigger bets are taken for a trading system that is particularly profitable (and no bets at all for one that just breaks even). See Kelly Criterion. A drawback is that it is difficult to estimate the parameters accurately; in my experience the profitability of a system tends to be overestimated when it is first developed, due to a variety of psychological and statistical biases. For this reason I recommend the risk based methods, at least to start with.

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.