Stock Portfolio Organizer
The ultimate porfolio management solution.
Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Gauss kernel and VolumeOsc Kernel for Amibroker (AFL)
Rating:
5 / 5 (Votes 1)
Tags:
oscillator, amibroker
Gauss kernel and VolumeOsc Kernel
Indicator / Formula
Copy & Paste Friendly
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 | _SECTION_BEGIN ( "Gauss Kernel" ); SetChartBkColor ( ParamColor ( "Panel Color" , colorBlack ) ); SetChartBkGradientFill ( ParamColor ( "Upper Chart" , colorBlack ), ParamColor ( "Lower Chart" , colorBlack ) ); function Normalize( array, arraylen ) // Figure 1.7 on p. 7 { MaxH = HHV ( array, arraylen ); MinL = LLV ( array, arraylen ); Value1[0] = array[0]; // Initialize as array for ( i = 1; i < BarCount ; i++ ) { Value1[i] = .5 * 2 * ( ( array[i] - MinL[i] ) / IIf ( MaxH[i] - MinL[i] == 0, 1, MaxH[i] - MinL[i] ) - .5 ) + .5 * Value1[i-1]; if ( Value1[i] > .9999 ) Value1[i] = .9999; if ( Value1[i] < -.9999 ) Value1[i] = -.9999; } return Value1; } PI = 3.1415926; Data = ( H + L ) / 2; Med = ( H + L + C ) / 3; MidPoint = 0; function Kernel( Input, Length ) { Norm = 0; sigma = ( Length + 1 ) / 4.0; for ( i = 0; i <= Length; i++ ) { Norm = Norm + exp ( -( ( Length / 2 - i ) * ( Length / 2 - i ) ) / ( 2 * sigma * sigma ) ); } array = Input; for ( j = Length; j < BarCount ; j++ ) { Filtered = 0; for ( k = 0; k <= Length; k++ ) { Filtered = Filtered + exp ( -( ( Length / 2 - k ) * ( Length / 2 - k ) ) / ( 2 * sigma * sigma ) ) * Input[j - k]; } array[j] = Filtered / Norm; } return array; } function Kernel_HMA( Input, N ) { f = Kernel( 2 * Kernel( Input, round ( N / 2 ) ) - Kernel( Input, N ), round ( sqrt ( N ) ) ); return f; } //Length1 = Param("Length1", 8, 2, 50, 1); Length2 = Param ( "Length2" , 13, 2, 50, 1 ); Length3 = Param ( "Length3" , 21, 2, 50, 1 ); Length4 = Param ( "Length4" , 5, 2, 50, 1 ); //Length5 = Param("Length5", 34, 2, 50, 1); //Smoothx = Kernel(C, Length1); Smoothy = Kernel( C , Length2 ); //Smoothz = Kernel(C, Length3); Smooth4 = Kernel( C , Length4 ); //Smooth5 = Kernel(C, Length5); //x = C - Smoothx; y = C - Smoothy; z = C - Smooth4; //f4 = C - Smooth4; //f5 = C - Smooth5; //Normx = Kernel_HMA(x/sqrt(Kernel(x^2,Length1)),2); Normy = Kernel_HMA( y / sqrt ( Kernel( y ^ 2, Length2 ) ), 2 ); Normz = Kernel_HMA( z / sqrt ( Kernel( z ^ 2, Length4 ) ), 2 ); // Norm4 = Kernel_HMA(f4/sqrt(Kernel(f4^2,Length4)),2); //Norm5 = Kernel_HMA(f5/sqrt(Kernel(f5^2,Length5)),2); //Buy = ( Cross(Normx,0) OR Cross(Normy,0) OR Cross(Normz,0)) AND (Normx > Ref(Normx,-1) AND Normy > Ref(Normy,-1) AND Normz > Ref(Normz,-1)); //Sell = ( Cross(0,Normx) OR Cross(0,Normy) OR Cross(0,Normz) ) AND (Normx < Ref(Normx,-1) AND Normy < Ref(Normy,-1) AND Normz < Ref(Normz,-1)); // FisherXform = Fisher(Normalize(Med, 20)); barvisible = Status ( "barvisible" ); //Buy = ExRem(Buy,Sell); //Sell = ExRem(Sell,Buy); //shape = Buy * shapeUpArrow + Sell * shapeDownArrow; //PlotShapes( shape, IIf( Buy, colorBrightGreen, colorRed ), 0, IIf( Buy, 0 , 0)); //Plot(Normx, "Normx", colorYellow, styleThick); Plot ( Normy, "Normy" , colorAqua , styleThick ); Plot ( Normz, "Normz" , colorRed , styleThick ); //Plot(Norm4, "Normz", colorOrange, styleThick); //Plot(Norm5, "Normz", colorOrange, styleThick); Plot ( 0, "" , colorWhite , styleThick ); Plot ( 4, "" , colorWhite , styleThick ); Plot ( -4, "" , colorWhite , styleThick ); Plot ( 3 , "" , colorWhite , styleThick ); Plot ( -3, "" , colorWhite , styleThick ); _SECTION_END (); PlusDM = IIf ( High > Ref ( High , -1 ) AND Low >= Ref ( Low , -1 ), High - Ref ( High , -1 ), IIf ( High > Ref ( High , -1 ) AND Low < Ref ( Low , -1 ) AND High - Ref ( High , -1 ) > Ref ( Low , -1 ) - Low , High - Ref ( High , -1 ), 0 ) ); Vm = log ( EMA ( V , 3 ) ); b = ( C - L ) * Vm + ( H - O ) * Vm + IIf ( C > O , ( C - O ) * Vm, 0 ) + PlusDM * Vm + IIf ( Ref ( C , -1 ) < O , ( O - Ref ( C , -1 ) ) * Vm, 0 ); MinDM = IIf ( Low < Ref ( Low , -1 ) AND High <= Ref ( High , -1 ), Ref ( Low , -1 ) - Low , IIf ( High > Ref ( High , -1 ) AND Low < Ref ( Low , -1 ) AND High - Ref ( High , -1 ) < Ref ( Low , -1 ) - Low , Ref ( Low , -1 ) - Low , 0 ) ); s = ( H - C ) * Vm + ( O - L ) * Vm + IIf ( C < O , ( O - C ) * Vm, 0 ) + MinDM * Vm + IIf ( Ref ( C , -1 ) > O , ( Ref ( C , -1 ) - O ) * Vm, 0 ); Wm = Wilders ( Wilders ( b, 3 ) - Wilders ( s, 3 ), 3 ); Wm1 = MA ( Wm, 8 ); Color = IIf ( Wm > 10, colorBlue , IIf ( Wm < -10, colorRed , 7 ) ); // Plot(Wm,"Volume",Color,2|styleThick); // Plot(Wm1,"Wm(8P)",11,styleLine); // Plotlinewidth( Wm1 ,"",colorwhite,styleLine,Null,Null,0,3,1); //Plot(0,"",ParamColor("Zero Line",colorGrey50),styleLine|styleNoLabel); f4 = Wm; Norm4 = Kernel_HMA( f4 / sqrt ( Kernel( f4 ^ 2, Length4 ) ), 2 ); //Norm5 = Kernel_HMA(f5/sqrt(Kernel(f5^2,Length4)),2); Plot ( Norm4, "NormVal" , coloryellow , styleThick ); |
0 comments
Leave Comment
Please login here to leave a comment.
Back