>Alex and Bob, would you guys provide a technical analysis and critique of >this XMA function using the filter concepts in your previous posts? How >does it compare to the functions you've posted? Do you see anyway to make >it "better" in terms of lag and overshoot? How would you improve it >according to your ways of thinking? Here is a bit of an improvement: --- Inputs: Price(NumericSeries),Leng(NumericSimple); Vars: EMA(0), n(leng), K(2/(n+1)), x((n-1)/2), y(0), m(Ceiling(0.3*x+1)), z(0); z = Price; y = 0.5 * (z + z[1]); EMA = K * (y + (y - y[m]) * x/m) + (1 - K) * EMA[1]; XAverage_ZeroLag = EMA; --- y is the two-bar average of price. This improves the high-frequency cut-off some and assures zero response at infinite frequency. The shortening the lookback period "m", to about 30% what you had improves the transient response some. The response on the Jurik test pattern (red curve) shows some overshoot and initial lag but the lag goes to one-half bar (the lag of the two-bar pre-filter) over time. The noise is gone because of the two-bar prefilter which has a null response at that frequency - not quite fair...) (The blue curve is one of my IIR filters for calibration.) Bob Fulks Attachment: BobR.06.gif
Attachment:
gif00022.gif
Description: "Description: GIF image"