--- In
amibroker@xxxxxxxxxxxxxxx, "Adrian" <adrian.mollenhorst@xxx> wrote:
>
> I see in here alot of examples of pair trades, based on a watchlist of pairs, however I want to hedge all my trades against a single symbol - the SPY.
>
> I have my watchlist of SP500 symbols, and I want to be able to backtest Excess returns. So for every Long, I want to be short SPY and every short, I want to be long SPY.
>
> I have tried 'SetForeign' with the following, but it never issues a SPY short:
>
>
> Buy = c==hhv(c,300);
> BuyPrice = C;
> Sell = BarsSince(Buy) ==6;
> SellPrice = C;
> PositionSize = -10;
>
> SetForeign("spy",True,True);
> Short = Buy;
> ShortPrice = C;
> Cover = Sell;
> CoverPrice = C;
> RestorePriceArrays(True);
>
> Any thoughts on how to take an opposite position on SPY to the long trade?
>
> Adrian
>