High Probability Trend Strategy

@panzerman, can you share a good, reliable source for Kalman filter formula that can be understood in simple and non-quant terms? I tried to look for Kalman filter implementation for Ninjatrader, but couldn;t find one; thinking of developing one myself.
For a tutorial on Kalman filtering have a look at this web site, and work through some of the examples. If you passed high school algebra, you should have no problem with the math.

https://www.kalmanfilter.net/default.aspx

Then for a bit more advanced viewpoint try reading this guys blog:

http://dekalogblog.blogspot.com/2019/04/test-of-constant-velocity-model-kalman.html

Kalman filters are actually more estimators than lowpass filters, but have similar design. Kalman filters are structured similar to IIR digital filters.
 
Do you know how to set up a Kalman filter? I took a MATLAB class because friends told me MATLAB is the language for Kalman.
Kalman filter algorithms can be written in any programming language. Search for John Ehlers Zero Lag (well almost). You will find his paper with simple code. This lowpass filter is about the best I have come across. I would describe it as a KALMANesq filter.
 
Kalman filter algorithms can be written in any programming language. Search for John Ehlers Zero Lag (well almost). You will find his paper with simple code. This lowpass filter is about the best I have come across. I would describe it as a KALMANesq filter.
Can I do it in Excel VBA?
 
Can I do it in Excel VBA?
Sure, here is my code. If price is in column A, enter a starting number cell B1, and enter =Kalman() in cell B2. The function is called from an active cell, so you have to copy and paste the function in each cell in column B.

Function kalman() As Double

Static alpha As Double
Dim leasterror As Long
Dim i As Integer
Dim ma As Double
Dim gain As Double
Dim best As Double
Dim error As Double

alpha = 0.07
ma = alpha * Cells(ActiveCell.Row, ActiveCell.Column - 1).Value2 + (1 - alpha) * Cells(ActiveCell.Row - 1, ActiveCell.Column).Value2
leasterror = 1000000
For i = -50 To 50
gain = i / 10
kalman = alpha * (ma + gain * (Cells(ActiveCell.Row, ActiveCell.Column - 1).Value2 - Cells(ActiveCell.Row - 1, ActiveCell.Column).Value2)) + (1 - alpha) * Cells(ActiveCell.Row - 1, ActiveCell.Column).Value2
error = Cells(ActiveCell.Row, ActiveCell.Column - 1).Value2 - kalman
If Abs(error) < leasterror Then
leasterror = Abs(error)
best = gain
End If
Next i
kalman = alpha * (ma + best * (Cells(ActiveCell.Row, ActiveCell.Column - 1).Value2 - Cells(ActiveCell.Row - 1, ActiveCell.Column).Value2)) + (1 - alpha) * Cells(ActiveCell.Row - 1, ActiveCell.Column).Value2

End Function
 
Sure, here is my code. If price is in column A, enter a starting number cell B1, and enter =Kalman() in cell B2. The function is called from an active cell, so you have to copy and paste the function in each cell in column B.

Function kalman() As Double
...
End Function
Nice work!
I'm thinking about how to modify the function to work in MS Access with a table of quotes ...
 
Sure, here is my code. If price is in column A, enter a starting number cell B1, and enter =Kalman() in cell B2. The function is called from an active cell, so you have to copy and paste the function in each cell in column B.

Function kalman() As Double

Static alpha As Double
Dim leasterror As Long
Dim i As Integer
Dim ma As Double
Dim gain As Double
Dim best As Double
Dim error As Double

alpha = 0.07
ma = alpha * Cells(ActiveCell.Row, ActiveCell.Column - 1).Value2 + (1 - alpha) * Cells(ActiveCell.Row - 1, ActiveCell.Column).Value2
leasterror = 1000000
For i = -50 To 50
gain = i / 10
kalman = alpha * (ma + gain * (Cells(ActiveCell.Row, ActiveCell.Column - 1).Value2 - Cells(ActiveCell.Row - 1, ActiveCell.Column).Value2)) + (1 - alpha) * Cells(ActiveCell.Row - 1, ActiveCell.Column).Value2
error = Cells(ActiveCell.Row, ActiveCell.Column - 1).Value2 - kalman
If Abs(error) < leasterror Then
leasterror = Abs(error)
best = gain
End If
Next i
kalman = alpha * (ma + best * (Cells(ActiveCell.Row, ActiveCell.Column - 1).Value2 - Cells(ActiveCell.Row - 1, ActiveCell.Column).Value2)) + (1 - alpha) * Cells(ActiveCell.Row - 1, ActiveCell.Column).Value2

End Function
Thanks, I appreciate the help.

Regards,
 
It took me 9 years, 30,000 hours and ten's of thousands of dollars to develop what your looking for. Do you seriously think anyone is just going to hand that over?

dear jeffalvisnon....everything comes with a price or a reason. Do not be so critical with newbies plus this is something you might find in a community like this....+ are you really the owner of the only holy grail of trading?
 
Gladwell's book "Outliers" says it only takes 10,000 hours to become an expert. Maybe trading is an exception. ;)


The 10,000 hours rule only applies to very narrow circumstances, and not to private retail trading as one example.

As another example, who would possibly believe it takes 10,000 hours to learn to drive a car?
 
My understanding is that Gladwell was not talking about 10,000 hours to be competent, as in driving a car, but in order to be expert, as in Mario Andretti.
 
My understanding is that Gladwell was not talking about 10,000 hours to be competent, as in driving a car, but in order to be expert, as in Mario Andretti.


This is correct, but the rule has been abused by extending it to trading. Also learning a foreign language and heaven knows what else.

I'd go so far as to suggest it would take 2 days to learn a simple profitable forex trading strategy, plus 1 day for familiarisation with the platform.
 
Back
Top