{******************************************************** Non-decimated Haar Wavelet Signal to Noise Ratio Copyright (c) Trade Smart Research Group 2002 Notes: The math is based on Multiresolution Analysis of Time Series www.multiresolutions.com ********************************************************} Inputs: Price(MedianPrice), {a price series} FirstScale(1); {the first scale from which indicators are drawn} vars: scales(0), count(0); Array: ArrayPrice[511](0); defineDLLFunc: "tswvl.DLL", FLOAT, "RUNWVL",LPFLOAT,int,float; {definition dll} defineDLLFunc: "tswvl.DLL", FLOAT, "GETALLVALUES",int,int; for count = 0 to 511 begin {the task of elements of Array} ArrayPrice[count] = Price[count]; end; value1 = FirstScale + 3; Value2 = RUNWVL(&ArrayPrice[0],value1, 3); {call dll function} value3 = GetAllValues(2,FirstScale); value4 = GetAllValues(2,FirstScale + 1); value5 = GetAllValues(2,FirstScale + 2); value6 = GetAllValues(2,FirstScale + 3); if value3 > 0 then Value7 = AbsValue(GetAllValues(1,FirstScale))/value3 else value7 = 0; if value4 > 0 then Value8 = AbsValue(GetAllValues(1,FirstScale + 1))/value4 else value8 = 0; if value5 > 0 then Value9 = AbsValue(GetAllValues(1,FirstScale + 2))/value5 else value9 = 0; if value6 > 0 then Value10 = AbsValue(GetAllValues(1,FirstScale + 3))/value6 else value10 = 0; if FirstScale > 4 then begin SetPlotColor(1, 13); SetPlotColor(2, 9); SetPlotColor(3, 14); SetPlotColor(4, 10); end; Plot1(value7, "First"); {drawing of charts} Plot2(value8, "First +1"); Plot3(value9, "First +2"); Plot4(value10, "First +3");
|