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!
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.