OPEN-SOURCE SCRIPT
Kalman Exponential SuperTrend

The Kalman Exponential SuperTrend is a new, smoother & superior version of the famous "SuperTrend". Using Kalman smoothing, a concept from the EMA (Exponential Moving Average), this script leverages the best out of each and combines it into a single indicator.
How does it work?
First, we need to calculate the Kalman smoothed source. This is a kind of complex calculation, so you need to study it if you want to know how it works precisely. It smooths the source of the SuperTrend, which helps us smooth the SuperTrend.
Then, we calculate "a" where:
n = user defined ATR length
a = 2/(n+1)
Now we calculate the ATR over "n" period. Classical calculation, nothing changed here.
Now we calculate the SuperTrend using the Kalman smoothed source & ATR where:
kalman = kalman smoothed source
ATR = Average True Range
m = Factor chosen by user.
Upper Band = kalman + ATR * m
Lower Band = kalman - ATR * m
Now we just smooth it a bit further using the "a" and a concept from the EMA.
u1 = Upper Band a bar ago
l1 = Lower Band a bar ago
u = Upper Band
l = Lower Band
Upper = u1 * (1-a) + u * a
Lower = l1 * (1-a) + u * a
When the classical (not Kalman) source crosses above the Upper, it indicates an uptrend. When it crosses below the Lower, it indicates a downtrend.
Methodology & Concepts
When I took a look at the classical SuperTrend => It was just far too slow, and if I made it faster it was noisy as hell. So I decided I would try to make up for it.
I tried the gaussian, bilateral filter, but then I tried kalman and that worked the best, so I added it. Now it was still too noisy and unconsistent, so I revisited my knowledge of concepts and picked the one from the EMA, and it kinda solved it.
In the core of the indicator, all it does is combine them in a really simple way, but if you go more deeply you see how it fits the puzzlé really well.
It is not about trying out random things´=> but about seeking what it is missing and trying to lessen its bad side.
That is the entire point of this indicator => Offer a unique approach to the SuperTrend type, that lessen the bad sides of it.
I also added different plotting types, this is so everyone can find their favorite
Enjoy Gs!
How does it work?
First, we need to calculate the Kalman smoothed source. This is a kind of complex calculation, so you need to study it if you want to know how it works precisely. It smooths the source of the SuperTrend, which helps us smooth the SuperTrend.
Then, we calculate "a" where:
n = user defined ATR length
a = 2/(n+1)
Now we calculate the ATR over "n" period. Classical calculation, nothing changed here.
Now we calculate the SuperTrend using the Kalman smoothed source & ATR where:
kalman = kalman smoothed source
ATR = Average True Range
m = Factor chosen by user.
Upper Band = kalman + ATR * m
Lower Band = kalman - ATR * m
Now we just smooth it a bit further using the "a" and a concept from the EMA.
u1 = Upper Band a bar ago
l1 = Lower Band a bar ago
u = Upper Band
l = Lower Band
Upper = u1 * (1-a) + u * a
Lower = l1 * (1-a) + u * a
When the classical (not Kalman) source crosses above the Upper, it indicates an uptrend. When it crosses below the Lower, it indicates a downtrend.
Methodology & Concepts
When I took a look at the classical SuperTrend => It was just far too slow, and if I made it faster it was noisy as hell. So I decided I would try to make up for it.
I tried the gaussian, bilateral filter, but then I tried kalman and that worked the best, so I added it. Now it was still too noisy and unconsistent, so I revisited my knowledge of concepts and picked the one from the EMA, and it kinda solved it.
In the core of the indicator, all it does is combine them in a really simple way, but if you go more deeply you see how it fits the puzzlé really well.
It is not about trying out random things´=> but about seeking what it is missing and trying to lessen its bad side.
That is the entire point of this indicator => Offer a unique approach to the SuperTrend type, that lessen the bad sides of it.
I also added different plotting types, this is so everyone can find their favorite
Enjoy Gs!
Script de código abierto
Siguiendo fielmente el espíritu de TradingView, el creador de este script lo ha publicado en código abierto, permitiendo que otros traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la publicación de este código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.
Script de código abierto
Siguiendo fielmente el espíritu de TradingView, el creador de este script lo ha publicado en código abierto, permitiendo que otros traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la publicación de este código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.