[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Hedge strategy



PureBytes Links

Trading Reference Links

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





------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    amibroker-digest@xxxxxxxxxxxxxxx 
    amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/