How to hedge long portfolio with index short?

Is it possible to hedge my longs with an index short? For example, say have a system that trades 10 names in the S&P500. Every time I enter a new long position, I would like to have an offsetting dollar sized index short - say SPY.

Any ideas on how this can be done?

I'm thinking that amibroker would run through the watchlist, then evaluate how many open positions, then establish or rebalance a SPY short position to equal size of the long portfolio.

Thanks in advance.

IT shouldn't be hard to code, first write your system to buy and sell your long positions. Then add a section using set foreign to change it to act on SPY. In that section, write the lines
Buy = Short;
Sell = Cover;

I would doubt that it would be a good system. The criteria that you use to calculate your buys will be designed or optimized to be the most profitable for that particular long trade. If you use that same criteria to short SPY, it isn't going to be your most profitable setup for the short trade. Likewise for the sells and covers. Plus you're going to pay double the commissions and double the slippage for twice as many trades that are working somewhat against each other.

You're probably better off to design two separate systems, one that goes long and the other that shorts SPY and optimize them independently. Then trade both systems at the same time to complement each other.

1 Like

To properly hedge a portfolio as you're proposing requires that you write a Custom Back Test (CBT).

1 Like