<< . .

. 17
( : 30)



. . >>

terrestrial, and atmospheric tides of the earth. The moon has been shown to affect
when coral spawn, when oysters open, when certain crimes are likely to be more
prevalent, and when “lunatics” (derived from the Latin word “luna,” which trans-
lates as “moon”) become more agitated. Moreover, women give birth and/or ovu-
late more frequently during the full moon.
When faced with the facts, the possibility of the moon influencing market
behavior is not so outlandish. Even Larry Williams (1979) found that the prices of
Silver, Wheat, Corn, and Soybean Oil rally when the moon is full and drop when
the moon is new!
Every amateur radio operator knows, “sunspots” exert a major influence on
long distance radio transmission. Sunspots appear as dark spots on the surface of
the sun. One theory is that they are produced by peculiarities in the gravitational
influences of neighboring planets on the Sun™s tidal rhythms. Another theory
explains sunspots as due to shifts in the sun™s magnetic poles. During high sunspot
activity, “skip” occurs: Short wavelength radio transmissions, which normally
carry only as far as line-of-sight, bounce off the ionosphere and may span dis-
tances of up to several thousand miles. Many have experienced this phenomenon
when watching television: A signal from a distant station will appear superim-
posed on a local one. Conversely, during low solar activity, long distance commu-
nication is much less likely at short wavelengths; anyone trying to achieve “DX”
(long distance communications), will need longer wavelengths.
Sunspot activity and solar flares are also correlated with terrestrial magnetic
storms that can disrupt sensitive electronics equipment and even knock out power
grids. Magnetic storms induced by solar eruptions in March I989 shut down the
Hydra-Quebec power system, blacking out parts of Montreal and Quebec for up
to nine hours (Space Science Institute, 1996).
Changes in solar activity are even suspected of causing major fluctuations in
the earth™s climate, as when the “Little Ice Age” occurred in the 1600s after 100
years of attenuated solar activity (Center for Solar and Space Research, 1997).
More relevant to traders: Edward R. Dewey, who established the Foundation
for the Study of Cycles in 1940, believed that there was a relationship between
sunspots and industrial production. Perhaps such a relationship is mediated by cli-
matological effects on agriculture, making it worthwhile to examine the correla-
tion between solar activity and agricultural commodity prices.
Our interest in sunspots peaked upon noticing that, during 1987, there
were only three days when the sunspot number (an index of solar activity) was
greater than 100. Two of those days were October 15 and 16! The probability
of the correspondence between Black Monday and heightened solar activity is
less than one in 100.
In the section below on “Lunar Cycles and Trading,” the impact of the lunar
phase on prices is examined. The impact of solar activity is examined in “Sunspots
and Market Activity.”


LUNAR CYCLES AND TRADING
In a previous study (Katz and McCormick, June 1997), we found that lunar cycles
could be used to profitably trade the NYFE. From 1990 to 1997, a simple lunar
system produced a net profit of $75,550. There were 170 trades, 60% profitable.
The average one contract trade made $444.41; the return-on-account was 365%
(not annualized). The long side performed better (520%) than the short (-37%).
The signals often marked turning points to the very day. Silver also responded
well, with signals picking off exact tops and bottoms; both longs and shorts were
profitable with a 190% return over the same period as for the NYFE. Even Wheat
traded profitably long and short with a 242% return. Given only one parameter (a
displacement in days since the full or new moon), and many trades, the results are
impressive and probably robust.
Our results were encouraging enough to justify further study of entries based
on these phenomena. The study will involve the phases of tbe moon, i.e., full
moon, fast quarter, last quarter, new moon, and all phases in between. Can the
lunar phase predict whether the market is bottoming or topping? Do bottoms (or
tops) form at the time of the full moon, or perhaps five days before the full moon,
or at the new moon? Since the lunar cycle may affect different markets differently,
the adaptive approach taken with seasonality is again used.


GENERATING LUNAR ENTRIES

There are many ways to time entries based on the lunar rhythm. Two approach-
es are employed in the tests: momentum and crossover. To calculate momentum,
a series of price changes is computed and then a centered smoothing (one that
induces no delays or phase shifts) is applied. For normalization, each price
change in the smoothed series is divided by the 50-day average true range. For
each bar, we ask: “What phase is the moon in currently?” As many past instances
as possible are found in which the moon was in the identical phase and the
momentum of prices on the corresponding bars is examined. The average of the
momentums becomes the value placed in the lunar momentum series, which
reflects the expected rate-of-change (momentum) in prices at a given time based
on historical price movement at the phase of the moon existing on the current
bar. Each number in the lunar momentum series is determined only by events
about 27 or more days ago; this is why centered smoothing, and other techniques
that look ahead in time relative to any specified bar, are permissible. Entries are
taken when momentum crosses above a positive threshold (a buy signal is
issued), or when momentum crosses below a negative threshold (a sell is post-
ed). Buying or selling can take place at the open, on a limit, or on a stop. The
momentum calculations and generation of entries closely follow those for sea-
sonality, but, instead of looking to previous instances of the same date in earlier
years, previous instances of the moon having a phase identical to that on the tar-
get bar are examined.
Entries can also be generated by computing the price differences, normaliz-
ing them, and integrating the series to obtain a pseudo-price series based on pre-
vious instances of the correct lunar phase. A moving average crossover model is
then applied to that series. Because the value at any bar in the series is determined
only by bars roughly 27 or more days ago, the delay in the crossovers can be com-
pensated for by looking ahead a small number of bars.
Both methods are adaptive in that no specific information is required
about the phase of the moon on which to place a buy or sell order. The adaptive
quality is important because different markets respond to the moon differently,
as seen in our earlier study. Both methods differ from the previous research,
where buys or sells occurred a fixed number of days before or after a full or a
new moon.
Several rules for handling confirmations and inversions are also tested to
determine whether better results can be obtained over the basic models. An exam-
ple of co@mation is the following: If a buy signal occurs on a given bar and
everything behaves as expected, the market should bottom around the time of the
buy; if instead it tops, the buy signal might be suspect, i.e., the market may not
be adhering to its typical seasonal or lunar timing. The crossover with cunfirmu-
rion model implements the crossover model with an additional rule that must be
satisfied before a buy or sell can be issued. lf a buy signal occurs, the Slow %K
on the signal bar must be less than 25%, meaning the market is near the bottom
of its recent historical range. Likewise, if the model generates a sell signal, a
check is made to see whether Slow %K is greater than 75%, indicating that the
market is near the top of its range, as would be expected if it is responding to
lunar influence. The con@nation and inversion model adds another element: If
a buy is signalled, and the market is near the top of its range (Slow %K greater
than 75%), then an inversion is assumed and, instead of issuing a buy, a sell order
is posted. If a sell is signalled, but the market is near the bottom of its recent
range, a buy order is issued.
The characteristics of lunar entries are similar to seasonal entries: Both are
predictive, rather than responsive, and thus lend themselves to countertrend trad-
ing. And, as with any predictive entry, they may be out of tune with market behav-
ior. As with seasonal entries, cycle or rhythm inversions may occur.
LUNAR TEST METHODOLOGY
All tests were performed using lunar entries to trade a diversified portfolio. Can
lunar entry models result in profitable trades? How have such models fared over
time? Have they become more or less profitable in recent years? The tests will
address these questions.
The exits are the standard ones. Entry rules are discussed when presenting
individual tests. Trades are closed out when either an entry in the opposing direc-
tion takes place, or when the standard exit closes the trade, whichever comes first.
The following code implements the lunar-based entry models that underlie all tests.
184
if˜mode = = 1) ( // jacknife mode
fmc(i = 1; i c= n; i*+) ( ,, for each t a r g e t bar
cnt = 0;
sum = 0.0;
far(j = 2; j c 1000; j++) ( /I walk b a c k w a r d s
date = ˜unamquivmte (dt [il, -j) i // source d a t e
i f lsdate c dt (31) b r e a k ; I/ run to beginning
// find index
hunt˜dt, n, Klate, w;
if cs&lte > dt K 1 !c++;
sum += "[kl ; ,, aCC"m"late average
cnt++;
I
far(j = 2; j < 1000; j++) ( I/ walk forwards
sdate = LunarEquivDate Cdtlil, j); ,, sou*ce date
ifcsdate > In) break; // a v o i d 00s d a t a
// f i n d i n d e x
huntcdt, n, sdate, f&l i
if (sdate > dt Lkl 1 !c++;
cntit; 8”nl += “Kc1 ; // accumulate average


a [il = sum / Cent + tiny) ; //
//
1
I
else if˜mode = = 2) ( I/
for(i = 1; i <= n; i++) [ //
sun = 0.0; cnt = 0;
walk backwards
for(j = 2; j c 1000; j++l [ //
if(cnt >= m) break; // e n o u g h c a s e s run
sdat,e = LunarEquivDate(dt Lil , -j); ,, source date
i f (sdate c dtL31) break;r u n to beginning
//
hunt˜dt, n, s&ate, &k); I/ find index
if (date > at w 1 !c++;
cnttt; S”rn += vlkl; //
j
for(j = 2; j c 1000; j++) [ /I
if(cnt >= ml break; J/
sdate = LunarEquivDate Cdt [il ,
hunttdt, n, sclate. &k, ; //
if(sdate a dtkll ki+;
cnt++; sum += “Lkl ; I/
1
a[il = s u m / (cnt + t i n y ) I/
i/
I
1
1
static void yodel (float *parms, float *dt, float *op. float 'hi.
float *cl=, float *vol. float *oi, float *dlrv, int nb.
float *lo,
TRDSIM .Lts, float %3&s) {


I/ Implements a variety of lunar-cycle trading models.
,, File = X13mod01.c
vector ˜l..MAxPRMI of parameters
// p==ms
vector [l..llb, Of dates in YYmDD form
// dt
vector [I. .nbl of opening prices
/I opn
vector Ll..nbl of high prices
// hi
YeCtOr [I. .rlb, Of low prices
// lo
vector Ll. .*I of closing prices
// ClS
Ye&or Ll. .nbl Of volumes
// VOl
vector [l..llb, Of open interest numbers
// oi
// dk" vector Il..nbl of average dollar volatilitiea
number of bars in data series or vectors
// nb
trading simulator class instance
// ts
vector Ll..nb, Of closing equity levels
/I eqcls


,, declare local Scratch variables
static int rc, cl,, ncontracts. maxhold. ordertrpe. signal;
static int avglen, disp, k, modeltype, matype, mktindx;
static float mmstp. ptlim. stpprice. limprice, tmp, thresh;
static float exitatr MAXBAR+ , savgM+XBAR+ll ;
static float Ina1 [MnxBan+ll, ma* mmxBAR+11, stochn"lAxBAR+ll;
static float *exitatrtabLMIUhlKT+ll, *savgtabWAXMKT+ll;


// copy parameters to local variables for clearer reference
avg1en = pans[ll; // length of moving averagea
= parms[*l ; // displacement factor
disp
-d,resh = parmsl31; ,, threshold for mm"ent"m models
matype = parms [-II ; ,, average type:
// l=simple moving average
11 2=exponential
/I 3=front-weighted triangular
/, 4=criangu1ar
// S=centered simple
// 6=centered exponential
/I 7=centered triangular
modeltype = parms L81 ; ,, model type:
,, 1=momentunl
,/ 2=crossoYer
I/ 3=crossover with confirm
I/ 4=˜rossover with confirm and inversions
ordertype = parms[9l; ,, entry: 1=open. 2=1imit, 3=stop
maxhold = 10; // maximum holding period
I/ profit target in volatility units
ptlim = 4;
mstp = 1; /I stop loss in volatility units

/I Perform whale-series computations that are unaffected by
// any parameter*. These may be performed once for each
// market, and saved in tables for repeated "se, thereby
// dramatically reducing execution time.
titindx = ts.modelo; /I market index
// allocated ?
if (exitatrtab hktindxl == NULL1 (
exitaCrtablmktindx1 = vector(l, nbl ; // exitatr table
savgtab lmktindxl = vector (1, nbl ; // savg table
AvgTrueRanges (exitafrtab [tnktindxl ,
hi, lo. ClS, 50, nb) i ,, SO-bar atr
float *p&g = vector(1, "b,i ,, .cx?.-LCh vector
pctlg˜1, = 0.0;
fcx(Cb = 2; Cb <= nb; cb++) (
tmp = ClS˜Cbl ClsLch-11; /I price change
tmp /= exiearrtab[titindxl L&l; // normalization
pchg[cbl = clipctmp, -2.0, 2.0); // clipping
I
Lunarllvg(sa"gtab[mktindxl,
,, lunar seasonal
p&g, dt, 2, 60, nbb);
free_"ector(pchg. 1, nb);
prinff(wkt: $d\n", mktindx); ,, show progress
)

// perform other whole-series computations
memcpy(exitatr, exitatrtabLmktindx1, sizeof(floati*nb);
memcpy(savg. sa"gtabImktindxl. sizeof(floatl*nbi
swiCch(modeltypeJ (
/I series for momentum model
case 1:
/I smoothing avg
MO"A"g(sa"g,sa"g,matype,avglen,nb);
for(cb = 1; cb <= nb; cbtt)
ma2Lcbl = fabskz"g[cblI;
/I avg deviation
Mo"?+"gmal, ma*, 1, 100, n!J);
break;
case 2: case 3: case 4: /I series for cro6so"er models
forccb = 2; cb c= nb; cb++)
sa"gLcbl += sa"gLcb-11; // integration
I/ smoothing avg
MovAvg(mal,savg,marype,avglen,nbl;
M˜"A"gLma2,mal,matype,a"glen,nb˜: I/ croesover avg
if(modeltype == 3 11 modeltype == 4) /I stochastic 08c
StDchOBc(stoch,hi.lo,˜˜*,˜,˜,˜b˜; // g-bar Past %K
break;
default: nrerrori"˜˜˜˜SMOD: invalid modeltype");
1
189
Several functions required to calculate lunar rhythms for any market in an
adaptive manner precede the code implementing the trading model. The imple-
mentation function, Model, follows the standard conventions: After declarations,
parameters are copied into local variables for easier reference. Comments indicate
what the parameters control. The hext block computes the SO-bar average true
range (exitatrrab), used in the exits and for normalization, as well as the lunar sea-
sonal series (savgrab), the predicted price changes for each bar. These series are
computed only once for each market and tabled; this may be done as no relevant
parameters change from test to test as Model is repeatedly called. A second block
calculates the model-specific time series needed to generate entry signals. If mod-
eltype is 1, the simple momentum model is used; 2 = the crossover model; 3 =
crossover with confirmation; and 4 = crossover with confirmation and inversion.
Among the series that may be computed are: smoothed lunar momentum, integrat-
ed lunar momentum (price-like series), moving averages for the crossover model,
and Slow %K for models involving confnmation and inversion. Depending on
modeltype, several other parameters may become important. One parameter,
avglen, controls the length of all moving averages: For the momentum model, it
controls the length of the centered triangular moving average; and for the crossover
models, it controls the length of the two moving averages those models require.
Another parameter, disp, sets the displacement: This is the look-ahead used, e.g., to
compensate for the lag of the moving averages. The parameter thresh is the thresh-
old used in the momentum model for both short and long trades (short trades use
the negative of thresh). Variable matype controls the type of certain moving aver-
ages: 1 = simple, 2 = exponential, 6 = centered exponential, 7 = centered trian-
gular; other moving averages are available, but are not used in the analyses. After
all series are calculated, a loop is entered that steps, day by day, through the mar-
ket to simulate trading. This loop contains code to update the simulator, determine
the number of contracts, avoid trading on limit-locked days, etc. The next block,
appearing within the bat-stepping loop, generates entry signals. The rules are deter-
mined by modeltype. Finally, a block handles posting the appropriate trading order,
as selected by the ordertype: 1 = entry at open, 2 = on limit, 3 = on stop.

LUNAR TEST RESULTS
Tests were run on four entry models: crossover, momentum, crossover with contir
mation, and crossover with confirmation and inversions. Each model was studied
with entry at open, on limit, and on stop. Table 9-l summarizes the results of all tests,
broken down by sample, entry order, and model. For each model, there is a row of
numbers containing the annualized portfolio return, and a row with the average port-
folio dollar profit or loss per trade. Averages across all order types for in-sample and
out-of-sample performance are in the two rightmost columns. The last two rows con-
tain the average across aI models for each type of order.
Tables 9-2 and 9-3 present information for each of the 12 tests on the spe-
cific commodities that the model traded profitably and those that lost, for the in-
sample (Table 9-2) and out-of-sample (Table 9-3) runs. The first column, SYM, is
the market being studied. The last column (COUNT™) is the number of profitable
tests for a given market. The numbers in the first row are Test identifiers. The last
row (COUNZJ contains the number of markets profitable for a given model. Tables
9-2 and 9-3 provide information about which markets are and are not profitable
when traded by each model: One dash (-) indicates a loss per trade of $2,000 to
$4,000; two dashes (- -) represent a loss of $4,000 or more; one plus sign (+)
means a profit per trade of $1,000 to $2,000; two pluses (+ +) indicate gains of
$2,00O,or more; a blank cell means a loss between $0 and $1,999 or a profit
between $0 and $1,000 per trade.

Tests of the Basic Crossover Model
A moving average (mnl) was computed for the integrated, price-lie lunar series. A
second moving average (ma2) was taken of the first moving average. A buy signal
was generated when ml crossed above ma2. A sell signal was generated when ma1
crossed below ma2. This is the same moving average crossover model discussed in
the chapter on moving averages, except here it is computed on a lunar series, rather
than on prices. The entries were effected by either a market at open (Test l), a limit
(Test 2), or a stop order (Test 3).
Optimization involved stepping the length of the moving averages (avglen)
from 5 to 15 in increments of 5, and the displacement (disp) from 0 to 15 in incre-



Performance of Lunar Models Broken Down by Model, Order, and
Sample
S-2
TABLE

In-Sample Performance Broken Down by Test and Market

107 108 It,,? 110 III Ii7 I COIINTI
k.YM iO1




.-
“, . . . ”

CD + l + - - ++ ++ ++ 5
ED - - - __ __ - ++ - 1: 1
+
CL + + ++ + 5
++ + ++ + ++ ++ - 8
HO




I I
I I I I I I
I I I I I
109 118 109 Ill 115 I
COUNT 108 115 107 108 108 109 111
TABLE S-3

Out-of-Sample Performance Broken Down by Test and Market
ments of 1. For entry at the open, the best performance (in terms of in-sample
risk-to-reward ratio) was achieved with a moving average length of 15 and a dis-
placement of 8: entry on a limit was best with a length of 15 and a displacement
of 6; entry on a stop required a length of 15 and a displacement of 12.
No tests showed profits in either sample. In-sample, best performance (least
average loss per trade) was with entry on limit; entry on stop produced poorer
results; entry at open was the worst. With the limit order, 43% of the 1,759 trades
were profitable. Out-of-sample, the limit order produced the smallest average loss
per trade and the stop yielded the largest loss. Overall, the system did not do well
on the entire portfolio. The relative performance of shorts and longs was incon-
sistent across orders and samples. In-sample, longs lost substantially more than

<< . .

. 17
( : 30)



. . >>