Attachments forums

List of attachments posted on this forum.


All files on forums: 103918

Re: Digital Filter indicators for MT4

IM241t, Sat Jan 18, 2020 11:22 pm

Hello, I'm new here, I'm curios and I'm trying to understand the logic and the math behind some of the indicators, in matters of trading it surely doesn't matter, the only thing that matters is how you use the indicator as I understand, anyhow I was looking into this indicator "LowPassFilter_v1.mq4" and looked through this piece of code and still don't have an idea as to what is trying to accomplish. I know it has something to do with the standard deviation calculations but anything other than that I see nothing. Can someone please give me at least a "kick" in the right direction in helping me understand this.
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;
LowPassFilter_v1.mq4
(6.35 KiB) Downloaded 394 times
All files in topic