Ok, let's forget excel for now. Below is code in Java (for some reason I can't post code on this forum). Length is 1000, Index is an iterator set to last bar. LowPass 0 and LowPass 1 are filled with price, rest is calculated. Last item in LP array is returned as LowPass value for last bar. Am I doing everything right?
Getting a zero lag moving average is easy: Step 1: Calculate a MA (any MA) of price Step 2: Calculate a second MA of the first MA using the same parameters. Step 3: 2*MA1-MA2 = zero lag MA However, having a zero lag MA doesn't give you any better performance as an indicator than any other MA. Again, do some proper back testing and prove it for yourself.
Let's keep this thread on track - I'm trying hard to see advantage of JCL's low pass filter over SMA, first.
And I'm trying to tell you that there really isn't any advantage. You can make any MA zero lag if you wish by using the above technique, but one zero lag MA is probably not better than any other zero lag MA.
That's the experience I have so far. But JCL swears by his low pass filter, so I'm trying to see if it's me doing something wrong, or is it... well, not sure what. I'm just keeping open mind, letting others to prove me wrong.
Luckyputanski: I do not necessarily swear by the Lowpass filter, which is by the way not my idea, but goes back to Ehlers. I'm saying that due to its low lag it's a tool that is useful for almost all systems. panzerman: I believe you that you see no improvement with your zero lag MA - I don't know where you got that recipe from, but it has obviously exactly the same lag as a normal SMA.
JCL, you stated many times in other threads that this low pass filter is better than SMA. I'm using SMA at the moment, but I would love to see something better. So far, low pass filter is not any better than SMA, so I'm asking you to prove me wrong. Is my java code correct?
You are somehow not doing the math right. Search for Rocket Science for Traders by Ehlers. He will break it down in detail for you.
I'm not sure that the Java code is correct, at least it calculates the function in a different way with a loop. The correct way would be to shift the series arrays first by 1, then calculate only the [0] term. Can't you just download Zorro or any other platform such as Ninja Trader that directly supports series? This would spare a long discussion or long workarounds in code - you can then just directly enter the code and test Lowpass vs. SMA in one minute.