VIX On The S&P 500 (Amibroker And Tradestation Code)

The strategy in plain English:

Buy the S&P 500 (SPY) at the close if the VIX breaks above its 10-day upper band two standard deviations away from its moving average.

Click here to see the original article.

Amibroker code:

TheVix = Foreign(“^VIX”,”close”,fixup=1);

Buy= TheVix > BBandTop(TheVix,10,2);
BuyPrice = Close;
Sell = C > Ref(H,-1) ;
sellPrice = Close;

Tradestation code:

If c data2 > BollingerBand(Close data2,10,2)
then buy this bar at close;
If close > high[1] then sell this bar at close;

Second VIX strategy:

The strategy in plain English:

Go long the S&P 500 at the close when the VIX breaks out on a new 20-day high and at the same time has a five-day RSI value of at least 65.

Click here to see the original article.

Amibroker code:

TheVix = Foreign(“^VIX”,”close”,fixup=1);

Buy = TheVix > Ref(HHV(TheVix,20),-1) AND RSIa(TheVix,5)>70;
BuyPrice = Close;
Sell = C > Ref(H,-1) ;
sellPrice = Close;

Disclosure: We are not financial advisors. Please do your own due diligence and investment research or consult a financial professional. All articles are our opinions – they are not suggestions to buy or sell any securities.