Also I'm curios how digital filtering ,which is used in signal processing where you have a predetermined signal, can be used in determining trends in trading where there is no predetermined signal that you get from a signal generator for example and you try to filter out the noise at the receiving end.
I know "google is your best friend" but I still wanted to ask, at the very least I can get a nudge in the right direction.
Code: Select all
int Length = FilterPeriod;
if (PctFilter>0)
{
Del[shift] = MathAbs(Filter[shift] - Filter[shift+1]);
double sumdel=0;
for (int j=0;j<=Length-1;j++) sumdel = sumdel+Del[shift+j];
AvgDel[shift] = sumdel/Length;
double sumpow = 0;
for (j=0;j<=Length-1;j++) sumpow+=MathPow(Del[j+shift]-AvgDel[j+shift],2);
double StdDev = MathSqrt(sumpow/Length);
double filter = PctFilter * StdDev;
if(MathAbs(Filter[shift]-Filter[shift+1]) < filter ) Filter[shift]=Filter[shift+1];
}
else
filter=0;