Genetic programs, data-snooping, and technical analysis, страница 3

Figure 1 is an example of a simple moving average rule represented as a genetic program. XR is a root node that requires two subnodes, which for this rule are the inequality operators > and <. The real values 1.02, 0.98, and 10, as well as the data CPR (closing price) are terminal nodes, nodes that do not have subnodes. Nodes >, <, *** (multiplication), and AVG (moving average) are operators, nodes that act as functions, and require one or more subnodes as inputs. Operator nodes may be either real-valued, such as *** and AVG, or logical-valued, such as > and <. XR is a trinary operator whose state is a function of the states of its subnodes (in this case, the subnodes are > and <), as displayed in Table I, where

FIGURE 1

Simple moving average trading rule.

long, neutral, and short positions are indicated by 1, 0, and 1, respectively. Rule 1 is a simple moving average rule which takes a long position if the closing price is 2% above the 10 day moving average of closing prices, and a short position if the closing price is 2% below the 10 day moving average price, and is neutral otherwise.

The choice of nodes in building the genetic programs is similar to those used in NWD and AK. Terminal nodes (those that take no arguments) may be real [-10, 10], Boolean (TRUE, FALSE), or return price data: OPR, HPR, LPR, CPR, VOL, and OI represent the opening, high, low, and closing price, the daily volume and open interest. Function nodes can be the arithmetic operations, +, -, x, and ÷, Boolean operators, IF–THEN–ELSE, AND, OR, NOT, inequalities, <, >, and the 1-norm

(absolute difference). Additionally, four functions are included that operate on lagged data, each of which requires two arguments, a data series (OPR, HPR, LPR, or CPR) and a real value, k, which indicates the number of prior observations over which to operate. LAG returns the k-day lagged value, MIN and MAX return the minimum and maximum values over the k-day period, and AVG returns the k-day average. MND and MXD are similar to MIN and MAX except that they return the number of days since

TABLE I

State of XR Given the Subnode States

XR

Subnode 1

Subnode 2

0

TRUE

TRUE

1

TRUE

FALSE

1

FALSE

TRUE

0

FALSE

FALSE

TABLE II

Nesting of Common Technical Indicators Within Functional/Terminal Node Sets

Nested in node sets

Technical indicator

AK/NWD

Current

Trend lines

X

Support/resistance

X[2]

X

Channel line

X

Percentage retracements

X

X

Speedlines

X

X

Gaps

X

Head and shoulders

Double tops/Bottoms

Triangles

Moving average

X

X

Envelopes

X

X

Bollinger Bands

Xa

X

Momentum

X

X

RSI

X

X

Stochastics

X

% R

X

MACD

X

X

Candlesticks

X


Recombination of two technical trading rules.

process (evaluate, select, operate) is repeated until convergence or the maximum number of iterations is reached.