From the November 01, 2010 issue of Futures Magazine • Subscribe!

System building from the ground up

In this article Art Collins discusses a simple strategy and then moves on to optimize it in various ways. Here are the corresponding codes in EasyLanguage for the system in its various forms.

TABLE 1--SEP 1-30

inputs:n(2),p(10),m(3),q(1);

variables:mm(0),co(0),x(0);

mm=month(date);

if month(date)=8 and dayofmonth(date)=31 and dayofweek(date)<>5 then sell short next bar at market;

if month(date)=8 and dayofmonth(date)>=29 and dayofmonth(date)<=31 and dayofweek(date)=5 then sell short next bar at market;

if month(date)=9 and dayofmonth(date)=30 and dayofweek(date)<>5 then buy to cover this bar on close;

if month(date)=9 and dayofmonth(date)>=28 and dayofmonth(date)<=30 and dayofweek(date)=5 then buy to cover this bar on close;

 

 

TABLE 1--OCT 1-31

inputs:n(2),p(10),m(3),q(1);

variables:mm(0),co(0),x(0);

mm=month(date);

if month(date)=9 and dayofmonth(date)=30 and dayofweek(date)<>5 then sell short next bar at market;

if month(date)=9 and dayofmonth(date)>=28 and dayofmonth(date)<=30 and dayofweek(date)=5 then sell short next bar at market;

if month(date)=10 and dayofmonth(date)=31 and dayofweek(date)<>5 then buy to cover this bar on close;

if month(date)=10 and dayofmonth(date)>=29 and dayofmonth(date)<=31 and dayofweek(date)=5 then buy to cover this bar on close;

 

 

TABLE 1--SEP 1-OCT 31

inputs:n(2),p(10),m(3),q(1);

variables:mm(0),co(0),x(0);

mm=month(date);

if month(date)=8 and dayofmonth(date)=31 and dayofweek(date)<>5 then sell short next bar at market;

if month(date)=8 and dayofmonth(date)>=29 and dayofmonth(date)<=31 and dayofweek(date)=5 then sell short next bar at market;

if month(date)=10 and dayofmonth(date)=31 and dayofweek(date)<>5 then buy to cover this bar on close;

if month(date)=10 and dayofmonth(date)>=29 and dayofmonth(date)<=31 and dayofweek(date)=5 then buy to cover this bar on close;

 

 

TABLE 2--SEP-SEP

variables:mm(0);

mm=month(date);

if month(date)=9 and mm<>mm[4] and mm=mm[3] and l

if month(date)=9 and dayofmonth(date)=30 and dayofweek(date)<>5 then buy to cover this bar on close;

if month(date)=9 and dayofmonth(date)>=28 and dayofmonth(date)<=30 and dayofweek(date)=5 then buy to cover this bar on close;

 

 

TABLE 2--OCT-OCT

variables:mm(0);

mm=month(date);

if month(date)=10 and mm<>mm[4] and mm=mm[3] and l

if month(date)=10 and dayofmonth(date)=31 and dayofweek(date)<>5 then buy to cover this bar on close;

if month(date)=10 and dayofmonth(date)>=29 and dayofmonth(date)<=31 and dayofweek(date)=5 then buy to cover this bar on close;

 

 

TABLE 2—SEP-OCT

variables:mm(0);

mm=month(date);

if month(date)=9 and mm<>mm[4] and mm=mm[3] and l

if month(date)=10 and dayofmonth(date)=31 and dayofweek(date)<>5 then buy to cover this bar on close;

if month(date)=10 and dayofmonth(date)>=29 and dayofmonth(date)<=31 and dayofweek(date)=5 then buy to cover this bar on close;

 

TABLE 3--CUP FILTER—SEP-SEP

variables:mm(0),e(0);

mm=month(date);

if l>l[1] and l[1]

if month(date)=9 and mm<>mm[4] and mm=mm[3] and l

and highest(e,4)=0 then sell short next bar at market;

if month(date)=9 and dayofmonth(date)=30 and dayofweek(date)<>5 then buy to cover this bar on close;

if month(date)=9 and dayofmonth(date)>=28 and dayofmonth(date)<=30 and dayofweek(date)=5 then buy to cover this bar on close;

 

TABLE 3--CUP FILTER—OCT-OCT

variables:mm(0),e(0);

mm=month(date);

if l>l[1] and l[1]

if month(date)=10 and mm<>mm[4] and mm=mm[3] and l

and highest(e,4)=0 then sell short next bar at market;

if month(date)=10 and dayofmonth(date)=31 and dayofweek(date)<>5 then buy to cover this bar on close;

if month(date)=10 and dayofmonth(date)>=29 and dayofmonth(date)<=31 and dayofweek(date)=5 then buy to cover this bar on close;

 

TABLE 3--CUP FILTER—SEP-OCT

variables:mm(0),e(0);

mm=month(date);

if l>l[1] and l[1]

if month(date)=9 and mm<>mm[4] and mm=mm[3] and l

and highest(e,4)=0 then sell short next bar at market;

if month(date)=10 and dayofmonth(date)=31 and dayofweek(date)<>5 then buy to cover this bar on close;

if month(date)=10 and dayofmonth(date)>=29 and dayofmonth(date)<=31 and dayofweek(date)=5 then buy to cover this bar on close;

 

TABLE 4--SHORTING OFF CAP TOPS--SEP

INPUTS:N(27);

variables:mm(0),e(0),f(0);

mm=month(date);

if hh[2] then e=1 else e=0;

if l>l[1] and l[1]

if highest(e,3)=1 and highest(f,3)=0 and month(date)=9 and mm=mm[2] and mm<>mm[3] then sell short next bar at market;

if dayofmonth(date)>=N then buy to cover this bar on close;

 

TABLE 4--SHORTING OFF CAP TOPS--OCT

INPUTS:N(27);

variables:mm(0),e(0),f(0);

mm=month(date);

if hh[2] then e=1 else e=0;

if l>l[1] and l[1]

if highest(e,3)=1 and highest(f,3)=0 and month(date)=10 and mm=mm[2] and mm<>mm[3] then sell short next bar at market;

if dayofmonth(date)>=N then buy to cover this bar on close;

 

TABLE 4--SEP-OCT CAP TOPS

INPUTS:N(27);

variables:mm(0),e(0),f(0);

mm=month(date);

if hh[2] then e=1 else e=0;

if l>l[1] and l[1]

if highest(e,3)=1 and highest(f,3)=0 and month(date)>=9 and month(date)<=10 and mm=mm[2] and mm<>mm[3] then sell short next bar at market;

if dayofmonth(date)>=N then buy to cover this bar on close;

 

TABLE 6—NOV CUP BOTTOMS—SEP CAP TOPS.

INPUTS:N(27);

variables:mm(0),e(0),f(0);

mm=month(date);

if hh[2] then e=1 else e=0;

if l>l[1] and l[1]

 

if highest(f,3)=1 and highest(e,3)=0 and month(date)=11 and mm=mm[2] and mm<>mm[3] then buy next bar at market;

if dayofmonth(date)>=N then sell this bar on close;

 

if highest(e,3)=1 and highest(f,3)=0 and month(date)=9 and mm=mm[2] and mm<>mm[3] then sell short next bar at market;

if dayofmonth(date)>=N then buy to cover this bar on close;

 

TABLE 6—DEC CUP BOTTOMS—OCT CAP TOPS.

INPUTS:N(27);

variables:mm(0),e(0),f(0);

mm=month(date);

if hh[2] then e=1 else e=0;

if l>l[1] and l[1]

 

if highest(f,3)=1 and highest(e,3)=0 and month(date)=12 and mm=mm[2] and mm<>mm[3] then buy next bar at market;

if dayofmonth(date)>=N then sell this bar on close;

 

if highest(e,3)=1 and highest(f,3)=0 and month(date)=10 and mm=mm[2] and mm<>mm[3] then sell short next bar at market;

if dayofmonth(date)>=N then buy to cover this bar on close;

 

TABLES 6-7—4 MONTH CUPS-CAPS TOTAL.

INPUTS:N(27);

variables:mm(0),e(0),f(0);

mm=month(date);

if hh[2] then e=1 else e=0;

if l>l[1] and l[1]

 

if highest(f,3)=1 and highest(e,3)=0 and month(date)>=11 and month(date)<=12 and mm=mm[2] and mm<>mm[3] then buy next bar at market;

if dayofmonth(date)>=N then sell this bar on close;

 

if highest(e,3)=1 and highest(f,3)=0 and month(date)>=9 and month(date)<=10 and mm=mm[2] and mm<>mm[3] then sell short next bar at market;

if dayofmonth(date)>=N then buy to cover this bar on close;

<< Page 3 of 3
Comments
comments powered by Disqus