Overview: Wavelet Detrended & Denoised Price Function
B>Example 2. The function that provides the detrended price series, i.e. the price without long-term trend component. Obviously, it is nothing but the sum of wavelet coefficients.

It is possible to considerably improve standard oscillators using the detrended price instead of initial price. Here standard indicator RSI and the same indicator (a yellow line on the diagram) based on the TS_Wvl_DetrendPrice function are given. One can see that the modified indicator is smoother and catches the prices extrema much better then initial one.
| EasyLanguage: | {******************************************************** Non-decimated Haar Wavelet Detrended & Denoised Price Function Copyright (c) Trade Smart Research Group 2002 Notes: The math is based on Multiresolution Analysis of Time Series www.multiresolutions.com ********************************************************} Inputs: Price(NumericSeries), {a price series} Scales(Numeric), {number of scales <=9 } NSigma(Numeric); {threshold value signal / noise} vars: Lookback(0), count(0); {definition of variables} Array: ArrayPrice[511](0); {definition of Array} defineDLLFunc: "tswvl.DLL", FLOAT, "RUNWVL",LPFLOAT,int,float; {definition dll} defineDLLFunc: "tswvl.DLL", FLOAT, "GETALLVALUES",int,int; lookback = power(2, Scales); {calculation of quantity of elements of Array} for count = 0 to lookback -1 begin {the task of elements of Array} ArrayPrice[count] = Price[count]; end; Value1 = RUNWVL(&ArrayPrice[0],Scales, NSigma); {a call dll} Value2 = Scales + 1; TS_Wvl_DetrendPrice = Value1 - GetAllValues(3, value2); {function evaluation}
|
|