Indicators: The Hodrick-Prescott Filter - page 2

 

You don't need a small lambda for this filter. It splits the data into trend and errors, and the errors are close to normally distributed.

So you can build a channel. I use it this way (chart of the euro-buck 4 hours) (implemented in MATLAB). It will redraw only on large movements, and I enter a position only after breaking the MA

By the way, the posted code draws the filter incorrectly....

 
Constantin:

By the way, the really posted code draws the filter incorrectly....

What is the correct way?
 

I have not seen the lambda set like this


Lambda=0.0625/MathPow(MathSin(M_PI/Per),4);

 
Constantin:

I've never seen a lambda set like that.


Lambda=0.0625/MathPow(MathSin(M_PI/Per),4);


I thought you had found an error in the code. Set the lambda however you want. This formula is my invention not to set lambdas in hundreds of thousands and explain their meaning to people. It's much easier to set the smoothing period as in the muwings. This formula will automatically calculate the lambda for the filter to have similar smoothing as SMA with the same period. Check it out if you want.
 

Good morning friends,

I'm trying to set up the Hodrick-Prescott Filter indicator (https://www.mql5.com/en/code/143) but I'm getting warnings in the metaeditor that I have no idea how to fix. Here's a screen shot of how it looks on my MT5.

Could you help me in this battle?

Thanks and have a good weekend

Filtro de Hodrick-Prescott
Filtro de Hodrick-Prescott
  • votes: 20
  • 2014.01.14
  • gpwr
  • www.mql5.com
Filtro de Hodrick-Prescott.
Files: