Latest on ATNET:

#ftx-collapse #custodial-trading
#crypto-tools #eth

Data:   Charts:

Kc  · 09/01/22

ScriptSpotlight: Kalman Filters on Tradingview

Altcoin Trading Blog
08/19/22 · Crypto technical analysis

About This Blog Post

  1. Uses bitfinex  ( + more posts) 
  2. Uses tradingview  ( + more posts) 
  3. Filed as Charting
  4. On the same topic: Script Spotlight: Bollinger Band Width
  5. On the same topic: Another better Coinmarketcap - with a heatmap tool
  6. On the same topic: Script Spotlight: A/D Levels
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 AITECH Airdrop - 1000 random get 15 USD worth each, plus up to 1500 USD wo...
new Sanctuary Free Mint Raffle - Only for people who already own an NFT from Old Master Me...
new DST airdrop - This is only for Daystarter closed beta participants. Up ...
new Rebase Airdrop - 200 winners get 500 Rebase tokens each.
airdrop Angry Birds Giveaway - NFTs and tokens drop here. 300 WL + 5000 $HVH and 200 USD...
airdrop Maker Empower Giveaway - FCFS 500, random 500. 1750 USD worth in $MPOW in this Gle...
airdrop BTBR Giveaway - 1000 USD worth of $BTBR to 100 random. Easy tasks!
promo FlappyMoonbird Event on Bybit - until 5 Jun
promo Mint Phemex Soulpass - bonus now
promo LATOKEN events - until 8 Jun
promo ETH Rush on Bybit - until 18 Jun
promo Eldarune airdrop on Bybit - until 13 Jun