Latest on ATNET:

#ftx-collapse #custodial-trading
#crypto-fundamentals #yield

Data:   Charts:

Kc  · 09/01/22

ScriptSpotlight: Kalman Filters on Tradingview

Altcoin Trading Blog
06/27/23 · Crypto technical analysis
Welcome to AltcoinTrading's ScriptSpotlight series. In ScriptSpotlight, we review pine scripts that are available from the FREE version of Tradingview public library. If you don't have a TradingView account yet, make the free one here.
Tradingview never trade alone
Subscribe to our RSS feed
Airdrops / Blog


Kalman filter is a recursive algorithm that was developed to track a moving target and predict its future value. Its advantage is that it doesn’t ignore noise and statistical errors, instead it uses them as a part of its predictive estimate.

The filter has been widely used in navigation and engineering, but it has been no less useful in the asset management industry.

In any finance-related field, Kalman will usually be applied to a time series of data - and not just price data, it could be any economic performance indicators.

In trading and technical analysis particularly, the Kalman filter is used as a smoothing tool that offsets some of the lag that smoothing indicators usually have.

If you even chart, that should tell you that Kalman filter will do better than a moving average, if your goal is to smooth out price action with as little lag as possible.

Here’s a paper that documents a backtest of four different Kalman filter strategies.

Kalman filters on TradingView

Kalman filters have of course made it to TradingView’s public library. I’ve picked and reviewed the one script that I thought would be best to show off the basics.

If you want to explore the library yourself, do search for both “Kalman” as well as the alternative spelling “Kahlman” - there is a bunch of scripts under each of them.

Kalman Filter by Loxx in the Public Library

The Kalman Filter script by Loxx is just a transcript of MT4’s Kalman Filter done in pine script to make it compatible with TradingView.

On the charts it looks pretty much like a well-smoothed moving average, except it doesn’t lag:

Kalman Filter by Loxx

TradingView’s BTCUSD on 9 Aug 2022 with Kalman Filter by Loxx

Other than that, this pine script was updated to change colour based on “velocity”, a part of the Kalman formula that you won’t find in moving averages.

Kalman filter by loxx velocity

In Kalman used in technical analysis, velocity says how fast the price changes from candle to candle, and in which direction.

When the price decreases over time, the velocity component of Kalman will be negative. When that trend reverses, it will turn positive. In theory the change in velocity could point you to price reversals.

I find that on crypto markets, the velocity change lags, and that even on 5M timeframes. I looked at BTCUSD, ETHUSD, SOLUSD and their ratios, in the default settings it always lags.

When I increased the K value, which is used as a multiplier of velocity in this formula, it led to an improvement with lag but as it happens, it also started giving more false signals. The velocity would flip back and forth when market wasn’t really trending.

In forex, where Kalman is used a lot, the velocity lags as well but you end up losing less money through it as the forex markets’ moves are not as sharp as they are in crypto. A long way ahead until we get that sort of conditions!

kalman filter in forex

Either way, even forex traders recommend Kalman filter mainly for confirmation of trends and price dynamics.

As for that, Kalman filter is already an effective trend tracker in crypto markets. For that purpose it works well for both short-term charts as well longer time frames. Below is the weekly BTCUSD chart with Kalman filter in default settings.

You will still the most value if you combine it with a good momentum indicator such as RSI and its transformations.

weekly BTCUSD chart with Kalman filter in default settings

Kalman Filter by Loxx in the Public Library

There are other combos out there too, of course. For one, you can also use pine script strategies that combine advanced moving averages like Hull MA with Kalman filters to improve your trend tracking. The linked post includes one that is in the TradingView public library.

Disclosure: All products featured on AltcoinTrading.NET are independently chosen, but some of the links on this page are affiliate links. Read our full content disclosure to learn more.

You just read AltcoinTrading's ScriptSpotlight series. In ScriptSpotlight, we review pine scripts that are available from the FREE version of Tradingview public library. If you don't have a TradingView account yet, make the free one here.

This post belongs to series #scriptspotlight


Want to *really* learn crypto charting & technical analysis?

Hate to break it to you, but there's no trading school, no neatly structured course and no simple how to.
Read our articles to get familiar with the tools, but try everything hands on. Trading will press your emotions, you can only really learn it as you go.

All the good crypto charting tools and platforms are accessible for FREE in either TradingView app or at Bitfinex. Just start!

Get TradingView Signup at Bitfinex


Latest Airdrops & Bounties - Updated Daily

new Kraken Bitcoin Halving Giveaway - Kraken exchange is dabbing into the airdrop space and giv...
new Spellborne points - Collect points towards the upcoming airdrop.
airdrop Bitfinex 10k in BTC competition - Trade XAUt/BTC on spot markets and be among 20 top by vol...
airdrop Zulu Genesis Points - The sign up link is on testnet, but if you opt in and do ...
airdrop Moongate Quests - Complete quests to collect token points that can be conve...
promo Bitfinex 10k in BTC competition - until 3 May
promo Bitmart staking promo - staking promo
promo SimpleSwap Transaction Bonus - code SsITvSMQ0Cru0ERU
promo LATOKEN events - live
promo Cloudbet Turbo Thursday Deposit Bonus - link ->