Long/short portfolios
Backtest a portfolio with short positions.
In MEDGE any holding in a portfolio can be a short: mark it with one click and the backtest, the risk metrics, Monte Carlo, the reports and the Stress Lab treat it as a short, with long, short, net and gross exposure always in view. Useful for hedged books, pair trades, 130/30 portfolios and market-neutral strategies.
How it works
1. Enter your holdings and mark the shorts
Type tickers and weights as usual. Each row has an L/S switch: click it, or type a negative weight, and the holding becomes a short position.
2. Check long, short, net and gross
The editor totals the long side, the short side, the net exposure (long minus short) and the gross exposure (long plus short), so a 120/20 or a market-neutral book is visible at a glance.
3. Run the same analysis as any portfolio
Overview, backtest with rebalancing and costs, full risk metrics, Monte Carlo, reports, comparisons and the Stress Lab all take the short positions into account.
4. Stress the book, not just the longs
In the Stress Lab a short gains when its benchmark falls: a scenario shows how much the shorts offset the longs, holding by holding.
Net and gross exposure, on one example
Take a portfolio long the Nasdaq-100 and the S&P 500 and short the energy sector. Entered weights: QQQ 60%, SPY 40%, XLE −20%.
The net exposure is long minus short, 80%: how much the portfolio leans with the market. The gross exposure is long plus short, 120%: how much capital is at work on both sides.
For the analysis MEDGE scales the weights so that the gross exposure is 100% of the capital, which keeps every metric comparable with a long-only portfolio. The proportions between holdings, and the direction of each one, stay exactly as you entered them.
| Holding | Side | Entered | Analysed |
|---|---|---|---|
| QQQ | Long | +60.0% | +50.0% |
| SPY | Long | +40.0% | +33.3% |
| XLE | Short | −20.0% | −16.7% |
| Net · Gross | +80.0% · 120% | +66.7% · 100% | |
Arithmetic example of the scaling, no market data.
What you can analyse on a long/short book
- •Backtest with rebalancing policies and transaction costs, where each short position earns the opposite of its asset’s return.
- •Per-holding attribution: how much each long and each short added to or took from the result.
- •Full risk metrics on the combined book: volatility, max drawdown, Sharpe, Sortino, Calmar, VaR and CVaR (from the Essential plan).
- •Monte Carlo simulation of the long/short portfolio.
- •Allocation shown as bars, longs to the right and shorts to the left, since a pie chart cannot show a negative slice.
- •Stress Lab scenarios: how much the shorts cushion the longs when the shocked markets fall, holding by holding (from the Essential plan).
- •Side-by-side comparison of a long-only version and its hedged version, and portfolio reports in PDF, HTML or CSV.
Typical uses
Hedged portfolio
A long portfolio with a short on the index or sector it is most exposed to, to see how much drawdown the hedge removes and what it costs in return.
Pair trade
Long one stock or ETF and short a close peer, to test whether the spread between them paid over time and how volatile it was.
130/30 and market-neutral
Books with a partial short side or with longs and shorts of equal size, compared with a long-only benchmark on the same months.
Limits, stated plainly
- Weights are scaled to 100% gross exposure: the leverage implied by weights above 100% is not simulated.
- Stock-borrow fees, margin interest and dividends owed on shorted shares are not modelled, so short positions look slightly better than in practice.
- The optimizer searches long-only weights; short positions are entered by hand.
- Results are historical and illustrative, not a forecast and not investment advice.
Frequently asked questions
- Can I backtest a portfolio with short positions?
- Yes. In the MEDGE portfolio analyzer any holding can be marked as short with the L/S switch or by entering a negative weight. Backtests, risk metrics, Monte Carlo, reports and the Stress Lab then include the short side: a short position contributes the opposite of its asset’s return.
- How are long/short weights handled?
- Weights are scaled so that long plus short add up to 100% of the capital (gross exposure). A 130/30 portfolio, for example, is analysed as 81.25% long and 18.75% short. This keeps every metric comparable with a long-only portfolio; the extra leverage of the original weights is not simulated.
- What is the difference between net and gross exposure?
- Net exposure is long minus short and tells you how much the portfolio leans with the market. Gross exposure is long plus short and tells you how much capital is at work on both sides. A 100% long / 100% short book is market-neutral (net 0%) but has 200% gross exposure.
- Are borrowing costs included?
- No. Stock-borrow fees, margin interest and dividends owed on shorted shares are not modelled, so results for short positions are slightly optimistic. Trading costs set in the backtest apply as usual.
- Can the optimizer suggest short positions?
- Not at the moment: the 12 optimization objectives search long-only weights. You can still optimize the long side and then add short hedges by hand, or compare a long-only and a long/short version side by side.
- Is it available on the free plan?
- Yes. The portfolio analyzer with backtests, Monte Carlo and per-holding attribution is free, short positions included. The Stress Lab and the full risk metrics start from the Essential plan.
Related
How much does your hedge really remove?
Enter the longs, mark the shorts, run the backtest. Free plan, no card, no brokerage connection.
Start free