logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
MS Support  
#1 Posted : Thursday, November 10, 2022 7:56:04 PM(UTC)
MS Support

Rank: Advanced Member

Groups: Moderators, Registered, Registered Users, Subscribers
Joined: 10/8/2010(UTC)
Posts: 1,838

Thanks: 79 times
Was thanked: 148 time(s) in 144 post(s)

Note: .VIX is not available with DataLink. You can replace any .VIX references in the formulas below with VXc1 as needed.

Markos Katsanos’ article, “Trading the Fear Index,” provided systems for trading VIX based instruments. The MetaStock version of those systems are below.  The formulas can be placed in an expert advisor, exploration, or system test.  The suggested optimization values for a system test are in comments on the first four lines.

VIX ETF System:

A VIX ETF daily long-short trading system to be appled to daily charts.

Suggested instruments: VXX, VIXY, UVXY, VIXM, VXZ, SVOL

Buy Order:

Code:
VUpMax:= 50; {min 40/max 60/step 5}
Vbars:= 6;  {min 5/max 10/step 1}
StBarsSlow:= 25; {min 25/max 30/step 5}
StBarsFast:= 10; {min 10/max 15/step 5}
vix:= Security("ONLINE:.VIX", C);
vixh:= Security("ONLINE:.VIX", H);
vixl:= Security("ONLINE:.VIX", L);
spy:= Security("ONLINE:SPY", C);
spyh:= Security("ONLINE:SPY", H);
spyl:= Security("ONLINE:SPY", L);
StVixF:= Mov((vix-LLV(vixl,StBarsFast))/(HHV(vixh, StBarsFast)-LLV(vixl, StBarsFast)+.0001)*100, 3, S);
StSpyF:= Mov((spy-LLV(spyl,StBarsFast))/(HHV(spyh, StBarsFast)-LLV(spyl, StBarsFast)+.0001)*100, 3, S);
StVixS:= Mov((vix-LLV(vixl,StBarsSlow))/(HHV(vixh, StBarsSlow)-LLV(vixl, StBarsSlow)+.0001)*100, 3, S);
StSpyS:= Mov((spy-LLV(spyl,StBarsSlow))/(HHV(spyh, StBarsSlow)-LLV(spyl, StBarsSlow)+.0001)*100, 3, S);
VixDn:= (vix/Ref(HHV(vix,vbars),-1)-1)*100; 
VixUp:= (vixh/Ref(LLV(vixl,vbars),-1)-1)*100;
RC:= Correl( vix, Cum(1), vbars-1, 0 );
Buy:= StvixS > StspyS AND StvixF > StspyF AND StvixF > Ref(StvixF, -1) AND VixUp > VUpMax AND RC > .8 AND RC>Ref(RC, -1);
sell:= StspyF > StvixF OR StvixF < Ref(StvixF,-1);
ltrade:= If(buy, 1, If(sell, 0, PREV));
ltrade = 1 AND Ref(ltrade=0, -1)

Sell Order:

Code:
VUpMax:= 50; {min 40/max 60/step 5}
Vbars:= 6;  {min 5/max 10/step 1}
StBarsSlow:= 25; {min 25/max 30/step 5}
StBarsFast:= 10; {min 10/max 15/step 5}
vix:= Security("ONLINE:.VIX", C);
vixh:= Security("ONLINE:.VIX", H);
vixl:= Security("ONLINE:.VIX", L);
spy:= Security("ONLINE:SPY", C);
spyh:= Security("ONLINE:SPY", H);
spyl:= Security("ONLINE:SPY", L);
StVixF:= Mov((vix-LLV(vixl,StBarsFast))/(HHV(vixh, StBarsFast)-LLV(vixl, StBarsFast)+.0001)*100, 3, S);
StSpyF:= Mov((spy-LLV(spyl,StBarsFast))/(HHV(spyh, StBarsFast)-LLV(spyl, StBarsFast)+.0001)*100, 3, S);
StVixS:= Mov((vix-LLV(vixl,StBarsSlow))/(HHV(vixh, StBarsSlow)-LLV(vixl, StBarsSlow)+.0001)*100, 3, S);
StSpyS:= Mov((spy-LLV(spyl,StBarsSlow))/(HHV(spyh, StBarsSlow)-LLV(spyl, StBarsSlow)+.0001)*100, 3, S);
VixDn:= (vix/Ref(HHV(vix,vbars),-1)-1)*100; 
VixUp:= (vixh/Ref(LLV(vixl,vbars),-1)-1)*100;
RC:= Correl( vix, Cum(1), vbars-1, 0 );
Buy:= StvixS > StspyS AND StvixF > StspyF AND StvixF > Ref(StvixF, -1) AND VixUp > VUpMax AND RC > .8 AND RC>Ref(RC, -1);
sell:= StspyF > StvixF OR StvixF < Ref(StvixF,-1);
ltrade:= If(buy, 1, If(sell, 0, PREV));
ltrade = 0 AND Ref(ltrade=1, -1)

Sell Short Order:

Code:
VUpMax:= 50; {min 40/max 60/step 5}
Vbars:= 6;  {min 5/max 10/step 1}
StBarsSlow:= 25; {min 25/max 30/step 5}
StBarsFast:= 10; {min 10/max 15/step 5}
vix:= Security("ONLINE:.VIX", C);
vixh:= Security("ONLINE:.VIX", H);
vixl:= Security("ONLINE:.VIX", L);
spy:= Security("ONLINE:SPY", C);
spyh:= Security("ONLINE:SPY", H);
spyl:= Security("ONLINE:SPY", L);
StVixF:= Mov((vix-LLV(vixl,StBarsFast))/(HHV(vixh, StBarsFast)-LLV(vixl, StBarsFast)+.0001)*100, 3, S);
StSpyF:= Mov((spy-LLV(spyl,StBarsFast))/(HHV(spyh, StBarsFast)-LLV(spyl, StBarsFast)+.0001)*100, 3, S);
StVixS:= Mov((vix-LLV(vixl,StBarsSlow))/(HHV(vixh, StBarsSlow)-LLV(vixl, StBarsSlow)+.0001)*100, 3, S);
StSpyS:= Mov((spy-LLV(spyl,StBarsSlow))/(HHV(spyh, StBarsSlow)-LLV(spyl, StBarsSlow)+.0001)*100, 3, S);
VixDn:= (vix/Ref(HHV(vix,vbars),-1)-1)*100; 
VixUp:= (vixh/Ref(LLV(vixl,vbars),-1)-1)*100;
RC:= Correl( vix, Cum(1), vbars-1, 0 );
short:= vix<= LLV(vix,3) AND VixUp < VUpMax AND VixDn< -20 AND Vix > 15 AND StspyF>StvixF AND StspyF>Ref(StspyF, -1);
cover:= VixUp > VUpMax AND StvixF > Ref(StvixF, -1) AND RC>.8;
strade:= If(short, 1, If(cover, 0, PREV));
strade = 1 AND Ref(strade=0, -1)

Buy to Cover Order:

Code:
VUpMax:= 50; {min 40/max 60/step 5}
Vbars:= 6;  {min 5/max 10/step 1}
StBarsSlow:= 25; {min 25/max 30/step 5}
StBarsFast:= 10; {min 10/max 15/step 5}
vix:= Security("ONLINE:.VIX", C);
vixh:= Security("ONLINE:.VIX", H);
vixl:= Security("ONLINE:.VIX", L);
spy:= Security("ONLINE:SPY", C);
spyh:= Security("ONLINE:SPY", H);
spyl:= Security("ONLINE:SPY", L);
StVixF:= Mov((vix-LLV(vixl,StBarsFast))/(HHV(vixh, StBarsFast)-LLV(vixl, StBarsFast)+.0001)*100, 3, S);
StSpyF:= Mov((spy-LLV(spyl,StBarsFast))/(HHV(spyh, StBarsFast)-LLV(spyl, StBarsFast)+.0001)*100, 3, S);
StVixS:= Mov((vix-LLV(vixl,StBarsSlow))/(HHV(vixh, StBarsSlow)-LLV(vixl, StBarsSlow)+.0001)*100, 3, S);
StSpyS:= Mov((spy-LLV(spyl,StBarsSlow))/(HHV(spyh, StBarsSlow)-LLV(spyl, StBarsSlow)+.0001)*100, 3, S);
VixDn:= (vix/Ref(HHV(vix,vbars),-1)-1)*100; 
VixUp:= (vixh/Ref(LLV(vixl,vbars),-1)-1)*100;
RC:= Correl( vix, Cum(1), vbars-1, 0 );
short:= vix<= LLV(vix,3) AND VixUp < VUpMax AND VixDn< -20 AND Vix > 15 AND StspyF>StvixF AND StspyF>Ref(StspyF, -1);
cover:= VixUp > VUpMax AND StvixF > Ref(StvixF, -1) AND RC>.8;
strade:= If(short, 1, If(cover, 0, PREV));
strade = 0 AND Ref(strade=1, -1)

Short VIX(SVXY) System:

​​​​​​​ A SVXY Inverse VIX ETF daily long-short trading system for daily charts.

Suggested instrument: SVXY

Buy Order:

Code:
VUpMax:= 50; {min 40/max 60/step 5}
Vbars:= 6;  {min 5/max 10/step 1}
StBarsSlow:= 25; {min 25/max 30/step 5}
StBarsFast:= 10; {min 10/max 15/step 5}
vix:= Security("ONLINE:.VIX", C);
vixh:= Security("ONLINE:.VIX", H);
vixl:= Security("ONLINE:.VIX", L);
spy:= Security("ONLINE:SPY", C);
spyh:= Security("ONLINE:SPY", H);
spyl:= Security("ONLINE:SPY", L);
StVixF:= Mov((vix-LLV(vixl,StBarsFast))/(HHV(vixh, StBarsFast)-LLV(vixl, StBarsFast)+.0001)*100, 3, S);
StSpyF:= Mov((spy-LLV(spyl,StBarsFast))/(HHV(spyh, StBarsFast)-LLV(spyl, StBarsFast)+.0001)*100, 3, S);
StVixS:= Mov((vix-LLV(vixl,StBarsSlow))/(HHV(vixh, StBarsSlow)-LLV(vixl, StBarsSlow)+.0001)*100, 3, S);
StSpyS:= Mov((spy-LLV(spyl,StBarsSlow))/(HHV(spyh, StBarsSlow)-LLV(spyl, StBarsSlow)+.0001)*100, 3, S);
VixDn:= (vix/Ref(HHV(vix,vbars),-1)-1)*100; 
VixUp:= (vixh/Ref(LLV(vixl,vbars),-1)-1)*100;
RC:= Correl( vix, Cum(1), vbars-1, 0 );
Buy:= vix<= LLV(vix,3) AND VixUp < VUpMax AND VixDn< -20 AND Vix > 15 AND StspyF>StvixF AND StspyF>Ref(StspyF, -1);
sell:= VixUp > VUpMax AND StvixF > Ref(StvixF, -1) AND RC>.8;
ltrade:= If(buy, 1, If(sell, 0, PREV));
ltrade = 1 AND Ref(ltrade=0, -1)

Sell Order:

Code:
VUpMax:= 50; {min 40/max 60/step 5}
Vbars:= 6;  {min 5/max 10/step 1}
StBarsSlow:= 25; {min 25/max 30/step 5}
StBarsFast:= 10; {min 10/max 15/step 5}
vix:= Security("ONLINE:.VIX", C);
vixh:= Security("ONLINE:.VIX", H);
vixl:= Security("ONLINE:.VIX", L);
spy:= Security("ONLINE:SPY", C);
spyh:= Security("ONLINE:SPY", H);
spyl:= Security("ONLINE:SPY", L);
StVixF:= Mov((vix-LLV(vixl,StBarsFast))/(HHV(vixh, StBarsFast)-LLV(vixl, StBarsFast)+.0001)*100, 3, S);
StSpyF:= Mov((spy-LLV(spyl,StBarsFast))/(HHV(spyh, StBarsFast)-LLV(spyl, StBarsFast)+.0001)*100, 3, S);
StVixS:= Mov((vix-LLV(vixl,StBarsSlow))/(HHV(vixh, StBarsSlow)-LLV(vixl, StBarsSlow)+.0001)*100, 3, S);
StSpyS:= Mov((spy-LLV(spyl,StBarsSlow))/(HHV(spyh, StBarsSlow)-LLV(spyl, StBarsSlow)+.0001)*100, 3, S);
VixDn:= (vix/Ref(HHV(vix,vbars),-1)-1)*100; 
VixUp:= (vixh/Ref(LLV(vixl,vbars),-1)-1)*100;
RC:= Correl( vix, Cum(1), vbars-1, 0 );
Buy:= vix<= LLV(vix,3) AND VixUp < VUpMax AND VixDn< -20 AND Vix > 15 AND StspyF>StvixF AND StspyF>Ref(StspyF, -1);
sell:= VixUp > VUpMax AND StvixF > Ref(StvixF, -1) AND RC>.8;
ltrade:= If(buy, 1, If(sell, 0, PREV));
ltrade = 0 AND Ref(ltrade=1, -1)

Sell Short Order:

Code:
VUpMax:= 50; {min 40/max 60/step 5}
Vbars:= 6;  {min 5/max 10/step 1}
StBarsSlow:= 25; {min 25/max 30/step 5}
StBarsFast:= 10; {min 10/max 15/step 5}
vix:= Security("ONLINE:.VIX", C);
vixh:= Security("ONLINE:.VIX", H);
vixl:= Security("ONLINE:.VIX", L);
spy:= Security("ONLINE:SPY", C);
spyh:= Security("ONLINE:SPY", H);
spyl:= Security("ONLINE:SPY", L);
StVixF:= Mov((vix-LLV(vixl,StBarsFast))/(HHV(vixh, StBarsFast)-LLV(vixl, StBarsFast)+.0001)*100, 3, S);
StSpyF:= Mov((spy-LLV(spyl,StBarsFast))/(HHV(spyh, StBarsFast)-LLV(spyl, StBarsFast)+.0001)*100, 3, S);
StVixS:= Mov((vix-LLV(vixl,StBarsSlow))/(HHV(vixh, StBarsSlow)-LLV(vixl, StBarsSlow)+.0001)*100, 3, S);
StSpyS:= Mov((spy-LLV(spyl,StBarsSlow))/(HHV(spyh, StBarsSlow)-LLV(spyl, StBarsSlow)+.0001)*100, 3, S);
VixDn:= (vix/Ref(HHV(vix,vbars),-1)-1)*100; 
VixUp:= (vixh/Ref(LLV(vixl,vbars),-1)-1)*100;
RC:= Correl( vix, Cum(1), vbars-1, 0 );
short:= StvixS > StspyS AND StvixF > StspyF AND StvixF > Ref(StvixF, -1) AND VixUp > VUpMax AND RC > .8 AND RC>Ref(RC, -1);
cover:= StspyF > StvixF OR StvixF < Ref(StvixF,-1);
strade:= If(short, 1, If(cover, 0, PREV));
strade = 1 AND Ref(strade=0, -1)

Buy to Cover Order:

Code:
VUpMax:= 50; {min 40/max 60/step 5}
Vbars:= 6;  {min 5/max 10/step 1}
StBarsSlow:= 25; {min 25/max 30/step 5}
StBarsFast:= 10; {min 10/max 15/step 5}
vix:= Security("ONLINE:.VIX", C);
vixh:= Security("ONLINE:.VIX", H);
vixl:= Security("ONLINE:.VIX", L);
spy:= Security("ONLINE:SPY", C);
spyh:= Security("ONLINE:SPY", H);
spyl:= Security("ONLINE:SPY", L);
StVixF:= Mov((vix-LLV(vixl,StBarsFast))/(HHV(vixh, StBarsFast)-LLV(vixl, StBarsFast)+.0001)*100, 3, S);
StSpyF:= Mov((spy-LLV(spyl,StBarsFast))/(HHV(spyh, StBarsFast)-LLV(spyl, StBarsFast)+.0001)*100, 3, S);
StVixS:= Mov((vix-LLV(vixl,StBarsSlow))/(HHV(vixh, StBarsSlow)-LLV(vixl, StBarsSlow)+.0001)*100, 3, S);
StSpyS:= Mov((spy-LLV(spyl,StBarsSlow))/(HHV(spyh, StBarsSlow)-LLV(spyl, StBarsSlow)+.0001)*100, 3, S);
VixDn:= (vix/Ref(HHV(vix,vbars),-1)-1)*100; 
VixUp:= (vixh/Ref(LLV(vixl,vbars),-1)-1)*100;
RC:= Correl( vix, Cum(1), vbars-1, 0 );
short:= StvixS > StspyS AND StvixF > StspyF AND StvixF > Ref(StvixF, -1) AND VixUp > VUpMax AND RC > .8 AND RC>Ref(RC, -1);
cover:= StspyF > StvixF OR StvixF < Ref(StvixF,-1);
strade:= If(short, 1, If(cover, 0, PREV));
strade = 0 AND Ref(strade=1, -1)

Edited by user Thursday, November 10, 2022 7:57:29 PM(UTC)  | Reason: Not specified

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.