2. Data Mining Bias and Rule Evaluation
• Data mining is a process in which the profitability of many rules is compared so
that one or more superior rules can be selected.
• The observed performance of the best rule(s) in the back test overstates its
(their) expected performance in the future.
• This bias complicates the evaluation of statistical significance and may lead a
data miner to select a rule with no predictive power
• This problem can be minimized by using specialized statistical-inference tests.
The case study illustrates the application of two such methods: an enhanced
version of White's reality check and Masters' Monte-Carlo permutation
method.
3. Data Mining Bias and Rule Evaluation
Avoidance of
Data Snooping
Bias
Analyzed Data
Series
Technical
Analysis
Themes
Performance
Statistic:
Average Return
No Complex
Rules Were
Evaluated
4. Avoidance of Data Snooping Bias
• The data snooping bias is a statistical bias that appears when exhaustively searching
for combinations of variables, the probability that a result arose by chance grow with
the number of combinations tested.
• In order to minimize the probability that our results occurred simply by chance, we
can divide that data that we used in the back testing process into 2 samples.
• The first one is called the in-sample and it is the data sample that will be used to back
test all the combinations that result from the initial trading rules.
• The second one is called out-of-sample and it is used as a way to test the best
performing rules (the one that were picked from the in-sample back testing) on new
data.
5. The Case Study Defined in Statistical Terms
• The case study in terms of the key elements of a statistical study
• The Population: The population at issue is the set of daily returns that would be earned by a rule if
its signals were to be applied to the S&P 500 over all possible realizations of the immediate practical
future
• Population Parameter : The population parameter is the rule's expected average annualized return in
the immediate practical future.
• The Sample : The sample consists of the daily returns earned by a rule applied over the back-test
period
• Sample Statistic (Test Statistic) : The sample statistic is the average annualized return earned by a
rule when applied
• The Null Hypothesis (H0): The null hypothesis states that all 6,402 rules tested are without predictive
power. This implies that any observed profits in a back test were due to chance (sampling variability).
• The Alternative Hypothesis : alternative hypothesis asserts that a rule's back-tested profitability
systems from genuine predictive power
• The Statistical Significance Level: A 5 percent level of significance was chosen as a threshold for
rejection of the null hypothesis. This means there was a 0.05 probability of rejecting the H0
hypothesis when the H0 was, in fact, true.
• Practical Significance : practical significance relates to the economic value of the observed rule
return.
6. Rules: Transforming Data Series into Market Positions
• A rule is an input/output process.
• Transforms input(s), consisting of one or more time series, into an output, a
new time series consisting of +1's and −1's that indicate long and short
positions in the market being traded (i.e., S&P 500).
TA Rule Transforms Input into Output.
Raw Market Time Series as Rule Input.
7. Rules: Transforming Data Series into Market Positions
• Other rules utilize input series that have
been derived from one or more raw
market series by applying various
transformations to the market data.
• These preprocessed inputs are referred to
as constructed data series or indicators.
• An example of an indicator is the negative
volume index. It is derived from
transformations of two raw data series;
S&P 500 closing price and total NYSE daily
volume
• The transformations used in the creation
of the negative volume index and other
indicators used in the case study are
described in the following section.
9. Input Series to Rules: Raw Time Series and Indicators
Price and
volume
functions
Market-
Breadth
Indicators
Prices-of-
debt
instruments
Interest-rate-
spread
indicators
10. Price and Volume Functions
• Technical analysis practitioners have suggested a number of price and volume
functions: on-balance volume, accumulation distribution volume, money flow,
negative volume, and positive volume.
• The price-volume functions were used to create two types of indicators:
• (1) Cumulative Sums : Cumulative sum is the algebraic sum of all prior daily
values of the price-volume function. The daily value of a price-volume function
can either be a positive or negative quantity. Thus, an indicator defined as the
cumulative sum of the on-balance volume
• (2) Moving Averages : Moving average of a price-volume function will be a
stationary time series. Moving average only considers the observations within
the look-back span. Since price and volume functions can assume both positive
or negative values, a moving average will tend to remain within a relatively
confined range near zero.
11. Price and Volume Functions
Cumulative On-
Balance Volume
Moving Averages
of On-Balance
Volume
Cumulative
Accumulation-
Distribution
Volume (CADV)
Moving Averages
of Accumulation
Distribution
Volume
Cumulative Money
Flow (CMF)
Moving Averages
of Money Flow
Cumulative
Negative Volume
Index (CNV)
Moving Averages
of Negative
Volume Index
Cumulative
Positive Volume
Index (CPV)
Moving Averages
of Positive Volume
12. Market Breadth Indicators
• Market breadthrefers to the spread or difference between the number of
stocks advancing and the number declining on a given day, week, or other
defined time interval.
• Breadth indicators are of two forms: cumulative sums of daily figures and
moving averages of daily figures
• Breadth indicators that are cumulative sums display long-term trends,
whereas moving-average breadth indicators tend to have reasonably stable
mean values and fluctuation ranges.
13. Market Breadth Indicators
Cumulative
Advance-Decline
Ratio (CADR)
Moving Averages
of Advance-
Decline Ratio
Cumulative Net
Volume Ratio
(CNVR)
Moving Averages
of Net Volume
Ratio
Cumulative New
Highs-Lows Ratio
(CHLR)
Moving Averages
of New Highs/New
Lows Ratio (HLR1
and HLR30)
14. Prices-of-Debt Instruments from Interest Rates
• Interest rates and stock price levels move inversely.
• Taking the reciprocal (1/interest rate) interest rates can be transformed into
price-like time series that are, in general, positively correlated with stock
prices.
• This reciprocal series can be multiplied by a scaling factor such as 100. Thus, a
rate of 6.05 percent would be equivalent to a price of 15.38 (1/6.05 × 100).
• Case study and was performed on four interest rate series: threemonth
treasury bills, 10-year treasury bonds, Moody's AAA corporate bonds, and
Moody's BAA corporate bonds.
15. Interest Rate Spreads
• An interest-rate spread is the difference between two comparable interest
rates.
• Two types of interest-rate spreads were constructed for the case study;
• The durationspread : The duration spread, also known as the slope of the yield
curve, is the difference between yields on debt instruments having the same
credit quality but having different durations (i.e., time to maturity). The
duration spread used in the case study was defined as the yield on the 10-year
treasury note minus the yield on the three-month treasury bills (10-year yield
minus 3-month yield).
• The qualityspread: A quality spread measures the difference in yield between
instruments with similar durations but with different credit qualities (default
risk). The quality spread for the case study was based on two of
Moody's38long-term corporate bond series: AAA,39which are the highest
rated corporate debt, and BAA,40a lower rated grade of corporate debt. The
quality spread is defined here as AAA yield −BAA yield.
17. Trends
• Foundational principle of TA is that prices and yields move in trends that can
be identified in a sufficiently timely manner to generate profits.
• Most widely used are moving averages, moving-average bands, channel
breakout, and Alexander filters also known as zigzag filters.
• CBO operator transformed the input time series into a binary valued time series
consisting of +1 and −1.
• When the trend of the input series was in an uptrend, as determined by the
CBO, the rule's output was +1.
• Conversely, when the analyzed series was determined to be in a downtrend,
the output was −1.
• The identification of trend reversals in the input series by CBO is subject to lag.
• All trend indicators necessarily incur lag—a delay between the time the input
series experiences a trend reversal and the time the operator is able to detect
it. Lag can be reduced by making the indicator more sensitive
18. Extreme Values and Transitions
• “Extreme Values and Transitions” or Erules is based on
the notion that a time series conveys information when
it assumes an extreme high or low value or as it makes
the transition between extremes.
• High and low extremes can be defined in terms of
fixed value thresholds if the time series has a relatively
stable mean and fluctuation range (i.e., is stationary).
All input series used for E rules were made stationary
by applying the CN operator.
• E rules is given by the expression:=CN (LMA (Input
Series, 4), N-days)Where:CN is the channel
normalization operatorLMA is a linearly weighted
moving-average operator
19. Extreme Values and Transitions
• E-rule signals were generated when the channel
normalized smoothed series crossed a threshold.
• Given that there are two thresholds, an upper and
lower, and given that there are two directions in
which a crossing can occur (up or down)
• Four possible threshold-crossing events:
• 1.Lower threshold is crossed in the downward
direction.
• 2.Lower threshold is crossed in the upward direction.
• 3.Upper threshold is crossed in the upward direction.
• 4.Upper threshold is crossed in the downward
direction.
• Each E rule was defined in terms of two threshold-
crossing events:
• one specifying the long entry/short exit and the other
specifying the short entry/long exit
22. Divergence Rules
• A divergence is said to occur when one
member of the pair departs from their
shared trend.
• A divergence manifests itself as follows:
both series have been trending in the
same direction, but then one series
reverses its prior trend while its
companion continues its prior trend.
• Divergence analysis, is a potential signal
that the prior shared trend has weakened
and may be about to reverse.
23. Divergence Rules
• The Dow theory is based on divergence analysis , if one series begins to
diverge, it is taken as preliminary evidence that the trend is weakening and
may reverse.
• Types of Divergence :
Trend Coherence and Divergence
Positive (bullish) Divergence:
Troughs Compared
Negative Divergence (peaks compared)
24. Divergence Rules
• The Dow theory is based on divergence analysis , if one series begins to
diverge, it is taken as preliminary evidence that the trend is weakening and
may reverse.
• Types of Divergence :
Trend Coherence and Divergence
Positive (bullish) Divergence:
Troughs Compared
Negative Divergence (peaks compared)
25. Divergence Rules
• The Dow theory is based on divergence analysis , if one series begins to
diverge, it is taken as preliminary evidence that the trend is weakening and
may reverse.
• Types of Divergence :
Trend Coherence and Divergence
Positive (bullish) Divergence:
Troughs Compared
Negative Divergence (peaks compared)
26. Divergence Indicator
• Where:
• CN= Channel normalization operator
• n= Look-back span of the channel normalization
• the channel normalized value of each series can vary between 0 and 100, this
divergence indicator has a potential range of −100 to +100.
• Limitations of the Proposed Divergence Indicator
• When the indicator registers a value of zero, it indicates that there is no divergence;
both series have the same channel normalized values and can be presumed to be
trending together.
• However, there can be cases for which a value of zero does not indicate that the two
series are in phase.
• A value of zero would be an erroneous indication that the two series are trending
together. This is clearly a limitation of the proposed divergence indicator.
28. Double Channel Normalization
- The fluctuation range of the divergence indicator would vary considerably from one
pair to the next. This would make it -impractical to use the same threshold for all
pairings.
- The high threshold displacement that would be -suitable for a -companion -series
with a low degree of co-movement with the S&P 500 would never produce a signal
for a companion series with a high degree of co-movement to the S&P 500.
- For this reason, the initial formulation of the divergence indicator was deemed
impractical.
29. Double Channel Normalization
Divergence Indicator (Double Channel Normalization)
Where:
CN= Channel normalization operator
Series 1 = Companion series
n= Look-back span of the first channel normalization
- The modified version of the divergence indicator will have roughly the same
fluctuation range irrespective of the particular pair of time series being used,
making it practical to use uniform thresholds.
- If the channel normalization used a look-back span of 60 days, the second layer of
channel normalization used a look-back span of 600 days.
- It was assumed that a 10fold look-back span would be sufficient to establish the
fluctuation range of the basic divergence indicator.
30. Double Channel Normalization
Divergence Indicator (Double Channel Normalization)
Where:
CN= Channel normalization operator
Series 1 = Companion series
n= Look-back span of the first channel normalization
- The modified version of the divergence indicator will have roughly the same
fluctuation range irrespective of the particular pair of time series being used,
making it practical to use uniform thresholds.
- If the channel normalization used a look-back span of 60 days, the second layer of
channel normalization used a look-back span of 600 days.
- It was assumed that a 10fold look-back span would be sufficient to establish the
fluctuation range of the basic divergence indicator.
31. Double Channel Normalization
Divergence Rule Types :
- Upper and lower threshold were applied to the
modified divergence indicator to generate signals.
- A positive or bullish divergence was in effect when
the divergence indicator was above its upper
threshold.
- A negative or bearish divergence existed when the
divergence indicator was below the lower
threshold.
- A bullish divergence rule, which would call for long
positions in the S&P 500 when the divergence
indicator was above the upper threshold
- A bearish divergence rule, which would call for
short positions in the S&P 500 when the divergence
indicator was below its lower threshold.
32. Double Channel Normalization
- These 12 rule types are exactly the
same set used for the extreme value
and transition rules.
- This makes sense because the
modified divergence indicator is
similar to the indicator used for the E
rules because it has a fluctuation
range of 0 to 100 and has two
thresholds.
- The 12 divergence rule types,
presented , include the basic bullish
divergence (type 6), the bearish
divergence (type 7) and their
inversions (types 12 and 1).
33. Parameter Combinations and Naming Convention for
Divergence Rules
- Each divergence rule is defined by four parameters: type, companion
series, threshold displacement, and channel normalization look-back
span.
- There are 12 types of the divergence rules (see Table 31.4), 38
companion data series, 2 threshold displacement values—10 and 20,
and 3 look-back spans—15, 30, and 60 days. This gives a total of 2,736
divergence rules (12 × 38 × 2 × 3).
- Divergence rule, type 3, companion series 23 (positive volume index 30-
day moving average), threshold displacement = 10 (upper threshold =
60, lower threshold = 40), 30-day channel normalization look-back span.