back start next


[start] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] [49] [50] [51] [52] [53] [54] [55] [56] [57] [58] [59] [60] [61] [62] [63] [64] [65] [66] [67] [68] [69] [70] [71] [72] [73] [74] [75] [76] [77] [78] [79] [80] [81] [82] [83] [84] [85] [86] [87] [88] [89] [90] [91] [92] [93] [94] [95] [96] [97] [98] [99] [100] [101] [102] [103] [104] [105] [106] [107] [108] [109] [110] [111] [112] [113] [114] [115] [116] [117] [118] [119] [120] [121] [122] [123] [124] [125] [ 126 ] [127] [128] [129] [130] [131] [132] [133] [134] [135] [136] [137] [138] [139] [140] [141] [142] [143] [144] [145] [146] [147] [148] [149] [150] [151] [152] [153] [154] [155] [156] [157] [158] [159] [160] [161] [162] [163] [164] [165] [166] [167] [168] [169] [170] [171] [172] [173] [174] [175] [176] [177] [178] [179] [180] [181] [182] [183] [184] [185] [186] [187] [188] [189] [190] [191] [192] [193] [194] [195] [196] [197] [198] [199] [200] [201] [202] [203] [204] [205]


126

17 Adaptive Techniques

An adaptive technique is one that changes with maitet conditions. It could be as simple as usmg a percentage stop-loss; however, technicians have begun to associate the idea of "adaptive" with a broader scope, although the piwpose remains the same-to handle more changing conditions without manual intervention. The trends and indicators that are discussed in this chapter are able to change the calculation period. Under some conditions, such as sidewajs maitets, it may be best to use a slow trend or momentum, and during explosive intervals those same methods are expected to wort better if they respond quickly.

ADAPTIVE TREND CALCULATIONS

We begin by looking at techniques that varj the length of the trend. These techniques are based on a common premise that it is better to use a longer-term trend, one that is slower to react to price change, when the maitet is either in a-sidewajs-pattem, has low volatility or, in the case of Kaufinan, has high relative noise. This may seem a reasonable assumption, but identifjing a sidewajs maitet is very difficult. A price may be unchanged fran a week ago, yet during those 5 dajs it rose quickly for 3 dajs, then reversed sharply and. coincidently, was at the same level on the 5th day. as it continued to plunge. In many wajs these adaptive techniques improve the basic performance of standard trend calculations, but they cannot solve all of the problems.

Kaufinans Adaptive Moving Average

Kaufinans Adaptrve Movmg Average (KAMA), which began takmg form in 19-2. is based on the concept that a noisj maitet requires a slower trend than one with less noise. That is. the trendline must lag fiirther behind in a relatively noisj martet to avoid being penetrated by the price, which would cause a trend change. When prices move consistently in one direction, any trend speed may be used because there are no false changes of direction. The KAMA is intended to use the fastest trend possible, based on the smallest calculation period for the existing martet conditions, it varies the speed of the trend by using an exponential smoothing formula, changing the smoothing constant each period. The use of a smoothing constant was selected because it allows for a full range of trends, compared with the simple moving average that uses integer values and is limited in the selection of the fast-end speeds (see the discussion of exponential smoothing in Chapter 4,~TrendCalculations-).

: , = KAAM, tsc,x (Price - ,)

where KAMA, is the new adaptive moving average \ alue

KAMA, j is the previous adaptive moving average value Price is the current price (for period /)

sc, is the smoothing constant, calculated each period as follows:

.eePeirvI . Smarter Tr ne ilJci.iw-Hill NewY.tk 1 5 pp 1 for a ciurtete disniEEion tbs met d

sCi = [ER, X (fcistest - slowest) + slowest]

fastest = 2 / (fcistest moving average period + 1) slowest = 2/ (slowest moving average period + 1)

Iprice,-pricei iI



The fastest and slowest values represent the range of penods over which KAMA can var, each converted to its exponential smoothing constant equivalent. Nominally, these values are set to 2 and 3C. By squaring the smoothing constant components, the slow end becomes 3C x 3C, equal to an extremely unresponsive 9C0period trend. The effect of this is to stop the movement of the trendline when the market becomes very noisj. On the other end, when the maitel goes up steadily, without a reversal for n days, the speed of the trend can reach a very fast 4-period equivalent.

The efficiency ratio, ER, has more recently been called fractal efficiency. It has ttie value of I when prices move in the same direction for the full n periods, and a value of when prices are unchanged over the n periods. When prices move in wide swings within the interval, the sum of the denominator becomes very large compared with the numerator and ER approaches C. Smaller values of ER result in a smaller smoothing constant and a slower frend.

If you choose to use the default values for KAMA, where ER is calculated over 1 periods and the smoothing constant ranges from 2 to 3C (squared), its calculation can be expressed in Omega code as

KAMA - KAMA[1] + ((@absvalue(close-close[10])/

@summatior(@absvelue(close-closeri]),.10)* .6022) f . 645 jZ"? csb-na: : ]

Time Period for ER

In Kaufrnans Adaptive Moving Average, the time period only affects the calculation of the efficiency ratio. The piwpose is to keep that period, n, as small as possible so that the evaluation of a few dajs will allow the speed of the frend to change fran fast to slow and back again. Users may begin testing in the range of 8 to 1 dajs.

Choice of Volatility

The use of the volatility function, («summation((«absvalue(close-closeir,"",- in Omega code, adds all the individual price changes rather than looking only at the highlow range. Noise is considered more active when prices jump up and down. It is not as important that prices moved from a particular low to a certain high, but the pattern of how it was done. A market in which prices moved from low to high then back to the low and high again is clearly more volatile and noisier than one that made a single move from low to high.

Small Moves in One Direction

Occasionally there will be a series of price moves that progress in very small increments in one direction without a reversal, causing ER = I. Although this is theoretically correct, it may prove best to include a filter for those caseswhere the direction, D= /price, -price,-, I =:min, or a scaling function that does not allow the smoothing constant to produce the usual fast frend as the direction D moves below min.

Trading KAMA

The Adtrve Moving Average can be traded as any frend, and has the same characteristics of exponential smoothing. That is, when prices cross the frendline from up to down, the frendline must tum down. Although KAMA may use a frend with the equivalent of 9CC dajs, the value of the current KAMA will atill tum down a very small amount. Trading rules that base signals on the direction of the frendline should include a small band around the KAMA to prevent price penetrations during a sidewajs maitet to cause a change in the trading signal. Without this band, the benefit of a sidewajs KAMA frendline is eliminated.

When appljing KAMA to a trading program, it can be seen that higher values of the efficiency ratio, ER, are rarely reached using a calculation period greater than 14. This would require an exfremely directional move for 2 weeks of daily data. As longer periods are used, the pattem of ER becomes very uniform, based on the underlying level of noise in each market. Because peak levels in the ER cannot be sustained, they are valuable candidates for profit taking.

Programming KAMA

The following Easj Language user function can be used by a sjstem or indicator to calculate Kaufrnans Adaptive Moving Average.



[ : Kaufmers Adaptive Moving Average Copyright 1990-199B, PO Kaufman. All rights reserved!

Inputs: period(numericsimple); vars: efratio(O), smooth(l), fastend(.666), siowend(.0645),

( ), diff(O), signal(O), noise(O);

Icalculate efficieno ratiol e-ratio - 1;

diff = @absvalue(clDse - closeLl]); if currentbar > period then begin

signal - @absvalue(clDse - closeCperiod]);

noise = @5ummation(diff.period);

1* noise <> 0 then efratio -= signal / noise;

end;

if currentbar <- period then AMA - close;

smooth = @power(efratio*(fastend - slowend) + slowend,2);

AMA = AMA[1] + smooth*(close - AMALl]);

KAMA = AMA;

Chandes Variable Index Dynamic Average ( )1

Tushar Chandes Variable Index Dynamic Average ( ) first appeared in Technical Analjsis of Stodcs & Commodities in March 1992. Both VIDYA and Kaufinans KAMA use an exponential smoothing as a base for varjing the speed of the trend each day. VIDYA, however, uses a pivotal smoothing constant, which is fixed, and varies the speed by using a factor based on the relative volatility to increase or decrease the value of s.

VJDyA, = k-KsxC,+ ilkxs)xVIDyA-i

where s is a fixed smoothing constant, suggested as a 9 1 equivalent (i.e., s = 2/(9+1) = .20) is the dosing price

/ and t - \ represent the current and previous periods is the relative volatility, calculated as

k = @stdev<:c,«) / @stdev<c;w)

where <a>stdev is the standaxd deviation functiun is the recent past days

m is a longer historic interval in days, m > rt

Volatility

Chande uses a very practical relative volatility measure based on the standard deviation, or distribution of price moves over the past n dajs, compared with a longer historic pattern, taken over h dajs. When := 1 the current volatility is greater than the historic volatility; when < 1 the current volatility is lower. VIDYA can be written as an indicator in Omega code as



[start] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] [49] [50] [51] [52] [53] [54] [55] [56] [57] [58] [59] [60] [61] [62] [63] [64] [65] [66] [67] [68] [69] [70] [71] [72] [73] [74] [75] [76] [77] [78] [79] [80] [81] [82] [83] [84] [85] [86] [87] [88] [89] [90] [91] [92] [93] [94] [95] [96] [97] [98] [99] [100] [101] [102] [103] [104] [105] [106] [107] [108] [109] [110] [111] [112] [113] [114] [115] [116] [117] [118] [119] [120] [121] [122] [123] [124] [125] [ 126 ] [127] [128] [129] [130] [131] [132] [133] [134] [135] [136] [137] [138] [139] [140] [141] [142] [143] [144] [145] [146] [147] [148] [149] [150] [151] [152] [153] [154] [155] [156] [157] [158] [159] [160] [161] [162] [163] [164] [165] [166] [167] [168] [169] [170] [171] [172] [173] [174] [175] [176] [177] [178] [179] [180] [181] [182] [183] [184] [185] [186] [187] [188] [189] [190] [191] [192] [193] [194] [195] [196] [197] [198] [199] [200] [201] [202] [203] [204] [205]