BTCUSD
D HIGH
D LOW

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: A/D Levels
  5. On the same topic: 6 Trading Indicators Every Technical Trader Needs to Know
  6. On the same topic: Technical Analysis in Cryptocurrency Trading
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 Algoblocks Airdrop - Top 15 shills and 47 randos get rewards in tokens and NFT...
new ShadowFi NFT Aidrop - This launched only for 5 days. 3 Shadow Legends NFT's are...
new League of Kingdoms NFT aidrop - Top 10 by entries and 10 randos get an NFT box here.
new BTAF Airdrop - Only 3 winners here, there's a token prize and two prizes...
airdrop Saffi Airdrop - This quick Gleam just launched 18 Jan and has 7500 USD wo...
airdrop CoinW Giveaway - This is already a Spring Festival event, launched 16 Jan....
airdrop NAKSON Airdrop - First come Gleam, 700 first users get $NAX tokens and aft...
promo ISME Airdrop Promo - until 31 Mar
promo LATOKEN Airdrops and Giveaways - until 31 Jan
promo Bitforex USDC Promo - until 1 Feb
promo Bitmart Lunar New Year Promo - until 29 Jan
promo BitMart Python Bot Education - live