OPEN-SOURCE SCRIPT
Kalman Exponentialy Weighted Moving Average | MisinkoMaster

The Kalman Exponentialy Weighted Moving Average is a technical analysis tool providing users with more responsive and smoother signals, providing crystal-clear signals and giving investors valuable insights on market trends, however it could be used in many cases.
A deeper dive into the indicator:
When going through my creation of strategies, I had stumbled on an indicator called "EWMA", which worked decently, but it was far too simple in my opinion so I decided to combine the EMA & WMA, but with a little more complexity, and it has worked.
I began by learning how both MAs work, I already knew how WMA works, but EMA I did not.
After learning both I found out they were quite simple in principle and that there was a way to combine them in such way that you would get really good signals, however it was way too noisy.
While it could avoid major dumps that were not avoided by most indicators, it would lose that edge because of being too noisy.
After testing out many conditions, combinations & more, the best working one was this one:
WMA > KEWMA = long
WMA < KEWMA = short
I will explain this later, but this gave fast signals, and while it still was noisy it was better then before.
To smooth it out, I started testing price filters => Gaussian Filter and many more were tested out, but they either slowed it down to the point it was no longer of much use, or did not smooth it at all.
After testing the Kalman filter on this thing, I was shocked.
It was just right and made the indicator a lot better, smoothed it and kept most of the responsivness it had.
Now to the big question: "How is it calculated?"
Now first it needs to calculate the Kalman source, which smooths the source which will be used.
After that, we calculate the Weighted Moving Average for "n" period on the Kalman source.
Now that we have our WMA values, we need to calculate "a".
a is calculated in the following formula:
a = 2/(1+n)
where n is the user defined length
Now for the last part:
KEWMA = WMAyesterday * (1-a) + WMAtoday * a
This creates a very accurate and reactive indicator, that can prove useful in many uses, beyond those I will and did talk about.
For the trend logic as mentioned before:
Long = WMA > KEWMA
Short = WMA < KEWMA
This worked best, but you might find better ways of using it.
I think that is all I have to say about it, I left it open source so you can all code it in your strategies and play around with it.
Enjoy Gs!
A deeper dive into the indicator:
When going through my creation of strategies, I had stumbled on an indicator called "EWMA", which worked decently, but it was far too simple in my opinion so I decided to combine the EMA & WMA, but with a little more complexity, and it has worked.
I began by learning how both MAs work, I already knew how WMA works, but EMA I did not.
After learning both I found out they were quite simple in principle and that there was a way to combine them in such way that you would get really good signals, however it was way too noisy.
While it could avoid major dumps that were not avoided by most indicators, it would lose that edge because of being too noisy.
After testing out many conditions, combinations & more, the best working one was this one:
WMA > KEWMA = long
WMA < KEWMA = short
I will explain this later, but this gave fast signals, and while it still was noisy it was better then before.
To smooth it out, I started testing price filters => Gaussian Filter and many more were tested out, but they either slowed it down to the point it was no longer of much use, or did not smooth it at all.
After testing the Kalman filter on this thing, I was shocked.
It was just right and made the indicator a lot better, smoothed it and kept most of the responsivness it had.
Now to the big question: "How is it calculated?"
Now first it needs to calculate the Kalman source, which smooths the source which will be used.
After that, we calculate the Weighted Moving Average for "n" period on the Kalman source.
Now that we have our WMA values, we need to calculate "a".
a is calculated in the following formula:
a = 2/(1+n)
where n is the user defined length
Now for the last part:
KEWMA = WMAyesterday * (1-a) + WMAtoday * a
This creates a very accurate and reactive indicator, that can prove useful in many uses, beyond those I will and did talk about.
For the trend logic as mentioned before:
Long = WMA > KEWMA
Short = WMA < KEWMA
This worked best, but you might find better ways of using it.
I think that is all I have to say about it, I left it open source so you can all code it in your strategies and play around with it.
Enjoy Gs!
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.