Larry Connor's system based on ^VIX

var hExt, hExtSMA, ExtPane, SecrSMA: integer;
var Bar, p: integer;

SecrSMA := SMASeries(#Close, 10);

hExt := GetExternalSeries( '^VIX', #Close);
hExtSMA := SMASeries( hExt, 10 );

ExtPane := CreatePane( 100, true, true );
if '#Close' = '#Volume' then
PlotSeriesLabel( hExt, ExtPane, #Navy, #Histogram, '^VIX(#Close)' )
else
begin
PlotSymbol( '^VIX', ExtPane, 558, #Candle );
DrawLabel( '^VIX', ExtPane );
end;
PlotSeriesLabel( hExtSMA, ExtPane, #Red, #Thin, 'SMA(10)' );

PlotSeries( SMASeries( #Close, 10 ), 0, #Green, #Thick );

for Bar := 20 to BarCount - 1 do
begin
if LastPositionActive then
begin
p := LastPosition;
if PriceClose(Bar) > GetSeriesValue(Bar, SecrSMA) then
begin
SellAtClose( Bar, p, '' );
end
else
begin
Print('Price: ' + FloatToStr(PriceClose(Bar)) + ' SMA: ' + FloatToStr(SecrSMA));
end;
end
else
begin
if not LastPositionActive then
begin
if ((PriceClose(Bar) < PriceClose(Bar - 1)) //down 3 days in a row
AND (PriceClose(Bar - 1) < PriceClose(Bar - 2))
AND (PriceClose(Bar - 2) < PriceClose(Bar - 3)))
then
begin
if GetSeriesValue(Bar, hExt) > (1.05 * GetSeriesValue(Bar, hExtSMA)) then
BuyAtClose( Bar, '0' );
end;
end;
end;
end;
 
This script is based on the Larry Connor's system which uses the following trade parameters:

If the market (S&P 500) closes down 3 consecutive days in a row and the VIX closes more than 5% above its 10-period moving average on the day the market has its 3rd consecutive down close, then buy the market at the close.

Exit when the market closes above its 10-period moving average.

Notes: Although this system uses buy at close orders this could be easily traded by taking the actual VIX close at 4 PM and then buying SPY (or an S&P future) in after hours trading.
 
Long + Short Long Only Short Only Buy & Hold
Net Profit $2,142.64 $2,142.64 $0.00 $11,657.75
Profit per Bar $6.19 $6.19 $0.00 $3.64

Number of Trades 51 51 0 1
Avg Profit/Loss $42.01 $42.01 $0.00 $11,657.75
Avg Profit/Loss % 0.86% 0.86% 0.00% 233.54%
Avg Bars Held 6.78 6.78 0.00 3,205.00

Winning Trades 38 38 0 1
Winning % 74.51% 74.51% N/A 100.00%
Gross Profit $3,603.77 $3,603.77 $0.00 $11,657.75
Avg Profit $94.84 $94.84 $0.00 $11,657.75
Avg Profit % 1.95% 1.95% 0.00% 233.54%
Avg Bars Held 4.63 4.63 0.00 3,205.00
Max Consecutive 9 9 0 N/A

Losing Trades 13 13 0 0
Losing % 25.49% 25.49% N/A 0.00%
Gross Loss $-1,461.13 $-1,461.13 $0.00 $0.00
Avg Loss $-112.39 $-112.39 $0.00 $0.00
Avg Loss % -2.30% -2.30% 0.00% 0.00%
Avg Bars Held 13.08 13.08 0.00 0.00
Max Consecutive 3 3 0 N/A

Max Drawdown $-1,046.10 $-1,046.10 $0.00 $-9,518.72
Max Drawdown Date 7/23/2002 7/23/2002 N/A 10/19/2005

Profit Factor 2.47 2.47 0.00 INF
Recovery Factor 2.05 2.05 N/A 1.22
Payoff Ratio 0.85 0.85 0.00 INF
Ulcer Index 16.25 16.25 0.00 26.98
Wealth-Lab Error Term 607.70 607.70 0.00 90.44
Luck Coefficient 3.26 3.26 0.00 1.00
Pessimistic Rate of Return 1.62 1.62 0.00 0.00
 
Interesting. Thanks for posting this.

Not spectacular, but it does grind out some profits. (sorry about the formatting)

Code:
Last Five Years

	Long + Short	Long Only	Short Only	Buy & Hold	
Starting Capital	$200,000.00	$200,000.00	$200,000.00	$200,000.00
Ending Capital	$228,579.98	$228,579.98	$200,000.00	$171,177.06
Net Profit	$28,579.98	$28,579.98	$0.00	$-28,822.94
Net Profit %	14.29%	14.29%	0.00%	-14.41%
Annualized Gain %	2.71%	2.71%	0.00%	-3.06%
Exposure	12.34%	10.71%	0.00%	100.00%
				
Number of Trades	40	40	0	1
Avg Profit/Loss	$714.50	$714.50	$0.00	$-28,822.94
Avg Profit/Loss %	0.65%	0.65%	0.00%	-14.41%
Avg Bars Held	6.78	6.78	0.00	1,254.00
				
Winning Trades	28	28	0	0
Winning %	70.00%	70.00%	N/A	0.00%
Gross Profit	$54,720.00	$54,720.00	$0.00	$0.00
Avg Profit	$1,954.29	$1,954.29	$0.00	$0.00
Avg Profit %	1.82%	1.82%	0.00%	0.00%
Avg Bars Held	4.75	4.75	0.00	0.00
Max Consecutive	6	6	0	N/A
				
Losing Trades	12	12	0	1
Losing %	30.00%	30.00%	N/A	100.00%
Gross Loss	$-26,140.02	$-26,140.02	$0.00	$-28,822.94
Avg Loss	$-2,178.33	$-2,178.33	$0.00	$-28,822.94
Avg Loss %	-2.07%	-2.07%	0.00%	-14.41%
Avg Bars Held	11.50	11.50	0.00	1,254.00
Max Consecutive	2	2	0	N/A
				
Max Drawdown	$-20,420.00	$-20,420.00	$0.00	$-93,856.72
Max Drawdown %	-9.20%	-9.20%	0.00%	-45.67%
Max Drawdown Date	7/23/2002	7/23/2002	N/A	10/9/2002
				
Wealth-Lab Score	19.93	22.95	0.00	-4.46
Profit Factor	2.09	2.09	0.00	0.00
Recovery Factor	1.40	1.40	N/A	0.31
Payoff Ratio	0.88	0.88	0.00	0.00
Sharpe Ratio	0.72	0.72	0.00	-0.09
Ulcer Index	2.06	2.06	0.00	24.85
Wealth-Lab Error Term	0.81	0.81	0.00	8.25
Wealth-Lab Reward Ratio	3.33	3.33	N/A	-0.37
Luck Coefficient	2.83	2.83	0.00	0.00
Pessimistic Rate of Return	1.29	1.29	0.00	0.00
Equity Drop Ratio	0.77	0.77	0.00	-1.07


Position	Symbol	Shares	Entry Date	Entry Price	Exit Date	Exit Price	% Change	Net Profit	Bars Held	Profit/Bar	Entry Signal	Exit Signal	Cum Profit	MAE %	MFE %	
Long	SPY	1,000	11/30/2000	132.28	12/5/2000	137.72	4.10	5,420.00	3	1,806.67	0		5,420.00	-0.97	4.51
Long	SPY	1,000	12/15/2000	130.97	12/26/2000	132.34	1.03	1,350.00	6	225.00	0		6,770.00	-4.15	3.05
Long	SPY	1,000	2/21/2001	125.62	3/6/2001	126.08	0.35	440.00	9	48.89	0		7,210.00	-3.08	1.77
Long	SPY	1,000	3/22/2001	111.12	3/26/2001	115.94	4.32	4,800.00	2	2,400.00	0		12,010.00	0.00	4.63
Long	SPY	1,000	4/24/2001	121.58	4/25/2001	123.17	1.29	1,570.00	1	1,570.00	0		13,579.99	-0.52	1.72
Long	SPY	1,000	5/30/2001	125.30	6/5/2001	128.80	2.78	3,480.00	4	870.00	0		17,059.99	-0.14	3.14
Long	SPY	1,000	6/13/2001	124.80	6/21/2001	123.82	-0.80	-1,000.00	6	-166.67	0		16,059.99	-3.53	0.30
Long	SPY	1,000	7/6/2001	119.05	7/12/2001	121.19	1.78	2,120.00	4	530.00	0		18,179.99	-1.65	2.03
Long	SPY	1,000	7/24/2001	117.80	7/27/2001	120.81	2.54	2,989.99	3	996.66	0		21,169.98	-0.29	3.23
Long	SPY	1,000	8/30/2001	113.32	9/27/2001	102.27	-9.77	-11,070.00	15	-738.00	0		10,099.98	-17.23	3.06
Long	SPY	1,000	10/31/2001	105.80	11/1/2001	108.51	2.54	2,690.00	1	2,690.00	0		12,789.98	-0.35	3.03
Long	SPY	1,000	2/5/2002	109.17	2/11/2002	111.44	2.06	2,250.00	4	562.50	0		15,039.98	-1.07	2.26
Long	SPY	1,000	2/19/2002	108.76	2/20/2002	110.59	1.66	1,809.99	1	1,809.99	0		16,849.98	-0.86	1.68
Long	SPY	1,000	4/4/2002	112.67	4/16/2002	113.20	0.45	510.00	8	63.75	0		17,359.97	-2.19	0.85
Long	SPY	1,000	4/24/2002	109.41	5/8/2002	109.01	-0.38	-420.00	10	-42.00	0		16,939.97	-4.12	0.55
Long	SPY	1,000	5/29/2002	107.30	6/17/2002	104.12	-2.98	-3,200.00	13	-246.15	0		13,739.97	-8.20	1.17
Long	SPY	1,000	6/21/2002	99.28	7/5/2002	99.31	0.01	10.00	9	1.11	0		13,749.97	-5.60	1.62
Long	SPY	1,000	7/10/2002	92.12	7/29/2002	89.77	-2.57	-2,370.01	13	-182.31	0		11,379.97	-15.68	1.92
Long	SPY	1,000	8/5/2002	83.77	8/7/2002	88.10	5.15	4,310.00	2	2,155.00	0		15,689.97	0.00	5.65
Long	SPY	1,000	9/19/2002	84.70	10/1/2002	85.72	1.18	1,000.00	8	125.00	0		16,689.97	-5.31	1.50
Long	SPY	1,000	10/4/2002	80.80	10/11/2002	84.16	4.13	3,340.00	5	668.00	0		20,029.97	-4.62	4.86
Long	SPY	1,000	12/5/2002	91.43	12/16/2002	91.65	0.22	200.00	7	28.57	0		20,229.97	-2.36	0.81
Long	SPY	1,000	12/19/2002	89.16	1/2/2003	91.07	2.12	1,890.00	8	236.25	0		22,119.97	-2.30	2.40
Long	SPY	1,000	1/21/2003	89.25	2/14/2003	84.15	-5.74	-5,120.00	18	-284.44	0		16,999.97	-9.24	0.62
Long	SPY	1,000	7/17/2003	98.50	7/25/2003	100.23	1.74	1,710.00	6	285.00	0		18,709.98	-0.66	1.87
Long	SPY	1,000	9/26/2003	99.95	10/1/2003	102.08	2.11	2,110.00	3	703.33	0		20,819.98	-0.70	2.23
Long	SPY	1,000	11/18/2003	103.84	11/24/2003	105.59	1.67	1,730.00	4	432.50	0		22,549.98	-0.21	1.87
Long	SPY	1,000	3/10/2004	112.58	3/29/2004	112.59	-0.01	-10.01	13	-0.77	0		22,539.97	-3.31	0.61
Long	SPY	1,000	4/30/2004	110.96	5/21/2004	109.81	-1.05	-1,170.00	15	-78.00	0		21,369.97	-2.61	2.07
Long	SPY	1,000	6/28/2004	113.45	6/29/2004	113.92	0.40	450.00	1	450.00	0		21,819.97	-0.03	0.63
Long	SPY	1,000	7/6/2004	111.89	7/20/2004	111.64	-0.24	-270.00	10	-27.00	0		21,549.97	-1.70	0.61
Long	SPY	1,000	8/5/2004	108.40	8/16/2004	108.30	-0.11	-120.00	7	-17.14	0		21,429.98	-1.67	0.22
Long	SPY	1,000	10/14/2004	110.64	10/26/2004	111.54	0.80	880.00	8	110.00	0		22,309.98	-1.17	1.44
Long	SPY	1,000	1/3/2005	120.30	1/18/2005	119.47	-0.71	-850.00	10	-85.00	0		21,459.98	-2.33	0.20
Long	SPY	1,000	1/21/2005	116.78	1/31/2005	118.16	1.16	1,360.00	6	226.67	0		22,819.98	-0.35	1.26
Long	SPY	1,000	3/22/2005	116.90	3/30/2005	118.18	1.08	1,260.00	5	252.00	0		24,079.98	-0.56	1.11
Long	SPY	1,000	4/15/2005	114.15	4/25/2005	116.33	1.89	2,160.00	6	360.00	0		26,239.98	-0.53	2.06
Long	SPY	1,000	8/8/2005	122.65	8/11/2005	123.82	0.94	1,150.00	3	383.33	0		27,389.98	0.00	1.51
Long	SPY	1,000	9/21/2005	120.91	9/29/2005	122.66	1.43	1,730.00	6	288.33	0		29,119.98	-0.39	1.61
Long	SPY	1,000	10/5/2005	119.63	10/17/2005	119.11	-0.45	-540.00	8	-67.50	0		28,579.98	-2.30	0.53
 
Quote from rickty:

Choad,

Any chance of posting the WL code?
Thanks.

Richard
Here it is. It is essentially oil's code, just re-formatted:

Code:
{$NO_AUTO_EXECUTE}

var hExt, hExtSMA, ExtPane, SecrSMA: integer;
var Bar, p: integer;

SecrSMA := SMASeries(#Close, 10);

//**NOTE** VIX--X is TC2000.  Use ^VIX for most others

hExt := GetExternalSeries( 'VIX--X', #Close);
hExtSMA := SMASeries( hExt, 10 );

ExtPane := CreatePane( 100, true, true );

if '#Close' = '#Volume' then
  PlotSeriesLabel( hExt, ExtPane, #Navy, #Histogram, '^VIX(#Close)' )
else
begin
  PlotSymbol( 'VIX--X', ExtPane, 558, #Candle );
  DrawLabel( 'VIX--X', ExtPane );
end;

PlotSeriesLabel( hExtSMA, ExtPane, #Red, #Thin, 'SMA(10)' );

PlotSeries( SMASeries( #Close, 10 ), 0, #Green, #Thick );

for Bar := 20 to BarCount - 1 do
begin
 if LastPositionActive then
  begin
   p := LastPosition;
   if PriceClose(Bar) > GetSeriesValue(Bar, SecrSMA) then
     begin
      SellAtClose( Bar, p, '' );
     end
   else
     begin
       Print('Price: ' + FloatToStr(PriceClose(Bar)) + ' SMA: ' + FloatToStr(SecrSMA));
     end;
  end
 else
  begin
     if PriceClose(Bar) < PriceClose(Bar - 1) then//down 3 days in a row
       if PriceClose(Bar - 1) < PriceClose(Bar - 2) then
         if PriceClose(Bar - 2) < PriceClose(Bar - 3) then
          begin
          if GetSeriesValue(Bar, hExt) > (1.05 * GetSeriesValue(Bar, hExtSMA)) then
           BuyAtClose( Bar, '0' );
          end;
   end;
   
end;
 
Hmmm after looking at the results again, it actually did pretty damn good considering the SP500 has gone nowhere.

Chunky drop during the 9/11 period, but so did everything else.

Props to oil_trader for posting this. :cool:
 
Back
Top