I'd like to implement a Kalman crossover strategy, referencing Vladimir's pykalman example as a foundation.
The idea is to use a more responsive filter crossing over/under a less responsive filter. Looking at the wikipedia page for Kalman filter, I need to adjust the 'gain' to adjust the responsiveness.
Does anyone know how to do this? Looking at Pykalman docs there is no easy way to do so, and I can't quite parse the information presented in the article, even though it gives some clues (see excerpt below).
Thoughts? Vladimir?
From Wikipedia:
https://en.wikipedia.org/wiki/Kalman_filter#Kalman_gain_derivation
It is common to discuss the filter's response in terms of the Kalman filter's gain. The Kalman-gain is the weight given to the measurements and current-state estimate, and can be "tuned" to achieve a particular performance. With a high-gain, the filter places more weight on the most recent measurements, and thus conforms to them more responsively. With a low gain, the filter conforms to the model predictions more closely. At the extremes, a high gain close to one will result in a more jumpy estimated trajectory, while a low gain close to zero will smooth out noise but decrease the responsiveness.
When performing the actual calculations for the filter (as discussed below), the state estimate and covariances are coded into matrices because of the multiple dimensions involved in a single set of calculations. This allows for a representation of linear relationships between different state variables (such as position, velocity, and acceleration) in any of the transition models or covariances.
Vladimir
.ekz.
→The idea is to use a more responsive filter crossing over/under a less responsive filter.
There are thousands of ways to apply the Kalman filter to trading algorithms, from estimating the next bar's prices and the standard deviation of prices, to generating signals based on forecast errors and dynamically calculating hedge ratios.
A couple of years ago, we created over a hundred Kalman Filters applications on Quantopian that have not yet been ported to QuantConnect.
We'll see if the one you are looking for is there.
.ekz.
Thanks Vladimir , that's great. I'm looking forward to learning more about different Kalman applications for trading systems. In my learning about it, it seems quite powerful and applicable in a broad range of problem/solutions, spanning many industries. Amazing.
As for the challenge I mentioned above (more responsive Kalman to use for crossovers), I was able to achieve this by modifying the transition_covariance, and it seems to work. I'll share my findings in the other thread.
Vladimir
.ekz.
If you are satisfied with my answer, please accept it and we will continue our conversations about Kalman filters in your very popular thread.
.ekz.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!