Kalman Scalping
1 2

thread: Kalman Scalping

  1. #1

    Kalman Scalping

    Hello All,

    I'm still alive and just reporting from the Bunker on my most recent ideas that may interest some of you....

    Attached are a couple of charts showing a Kalman filter I have just managed to get working. I started this but could never get it functioning.

    As my reader(s) will understand, I have an aerospace history and have designed several guided missile autopilots in my time with Kalman filters. But for some strange reason, I could never get them to work satisfactorily for the markets.

    But I happenned to be reading the EURUSD thread at the Interactive forum and noticed a few articles by Hindustani (for instance https://www.cliqforex.com/general-fo...inary-gdp.html).

    (What's Old Dog reading the Interactive threads you may ask -- he is a life-long swing and position trader on the Daily and Weekly charts! Well.... I have a confession to make. Now I am retired and have much too much time on my hands, I am in serious danger of getting sucked in to the scalping world all of the dashing young blades with this forum are so fond of. )

    Hindustani's CCI indior looks remarkably like my Kalman and I suspect there is a lot more to his indior compared to just CCI. In reality, he states in one place (https://www.cliqforex.com/trading-sy...ics-trade.html) he is using an external Matlab set up to perform the calculations.

    So this got me thinking, and I reckon I may have discovered the bug in my approach!

    This is a scalpers fantasy -- the attached charts from today are rather common in all respects.

    Probably the most important thing to realise about the Kalman filter is it is NOT A FILTER! It is an estimator for signs buried in lots of noise. Not a bad description of the market on time frames that are low!! (See my thread https://www.cliqforex.com/trading-sy...-dominate.html on this).

    There's simply no question of repainting or any of the silly issues that plague lots of MT4 indiors along with the price-position estimates are rather statistically robust (p lt; 0.05). I am taking a very simple approach basing the current quote on the current price pivot, as well as the uncertainty (noise) on the range (hi - lo) of this pub. But simple seems to function just fine...

    I made some very good pips today and am at risk of becoming a day-trading enthusiast when I do not exercise some strict self-discipline!

    Like Hindustani, I can not post the indior since it's too complex. I have a somewhat convoluted system on my terminal which exports tick data from MT4 via the DDE server into Matlab. Matlab then does all the severe crunching that could be much too difficult in MQ4 language, then returns the results to MetaTrader.

    I would hate for any serious programmer to view my code - I would be far too ashamed!

    But some very fine developers on the Platform Tech forum have made very similar things available if anybody wants to have a move.

    I am simply offering this out of interest.

    Kind regards and Decent trading to all,

    Old Dog

    .


  2. #2
    Junior Member Copipk333's Avatar
    17
    I am simply offering this from interest.
    Offering what?

  3. #3
    Old_Dog,

    I enjoy your posts:you are into something new.Unlike you're (aerospace engineer) I am a porter in the neighborhood
    dockside carrying rice sacks .Long back I found kalman and comparable filters in Russian forums.Some of these men are coding and mathematics wizards.
    I m presuming to put these indiors as input/ouput for echo state network.Just be carefull with kalman once the markets are in rather strong trend disposition,other then you struck pinpoint entry exit with kalman stuff.All the best.


  4. #4
    Hello,

    As my reader(s) will understand, I've an aerospace background and have made several guided missile autopilots in my time using Kalman filters.
    I knew it! Kalman is rocket science!

    More seriously I'd like to see your code should you mind posting. I barely know the Kalman filter and don't know matlab so I hope for comments in the source code. I'd like to understand the model you use (the state vector and the transition matrix).

    I also have a dumb question about Kalman generally speaking. Since the model is indeed important but usually unknown, can it be possible to possess the transition matrix itself estimated by another Kalman filter ran in parallel of the first one using the output signal of the 1st filter for a feedback? (one can dream!)

    I am asking because I'd like to apply a Kalman filter on my wavelet decomposition (to get a Wavelet-Kalman filter) and now I Don't Have Any Notion of the model to utilize

    Thank you

  5. #5
    I was considering my trading a lot within the past month, and my most recent setbacks and realized that the previous four weeks the market has been mostly determined (I tend to stick to yen pairs, hard to not earn money there from Nov-early Jan).

    I decided what I needed was a way to smooth the data using a Kalman filter perhaps (Electrical technology here, btw). Find it ironic that you have recently been thinking along the very same lines - once I was considering reversion egy I discovered your posts too.

    I am a rather accomplished Matlab individual, actually all my egy modeling is done in matlab but I have not ever done the DDE data passing from Metatrader to Matlab....

    Do you have some quick insight while I do my research? The farthest I moved has been to compose some parameters to a text file and then use a program I wrote in C to call Matlab from a command line.... I was considering piping the data to python and using pandas because I have an interface, but all the Kalman-related heavy ling has been done in matlab...

  6. #6
    Junior Member kmokzok's Avatar
    27
    Casey is http://dekalogblog.blogspot.co.uk/20...completed.html useful? Otherwise, please ignore.

  7. #7
    TheMaxx,

    Funny I was browsing that site last night I was mainly interested in his own Naive Bayesian Classifier, that is sort of some other thing I'd like to incorporate, and that is a filter of some sort that can determine a trending vs ranging market.

    My idea goes something like this, I've this idea of market speed or price velocity, I call dP/dt, and could look at a couple different lags possibly for the dt term. I guessed though, that in order to get this done, some sort of smoothing would need to be done because excess noise could give many false signals.

    Like Old Dog says, Kalman filters help to identify the the true signals among noise...

    Anyway, just barely from the incubator at the moment, I'm going to crank out some code this weekend to find out what I can come up with.

    Casey

  8. #8
    My thought goes something like this, I've this notion of market speed or price speed, '' I call dP/dt, and would consider a couple of different lags maybe for the dt term. I guessed though, that in order to do this, some type of smoothing would need to get done because excess sound could give many false signs.
    Kalman requires a fantastic model of the underlaying process. What model do you are thinking about?
    I hunted if it is was possible to gauge the model itself in precisely the same time as the filter does its job. I found you can, that is called Dual Extended Kalman Filters however they seem to have a bad convergence.

    Additionally I'd love to learn how good is that a Kalman filter with non-Gaussian sound because the market sound looks much like a Cauchy distribution where the variance is infinite. This does not help for the covariance matrix...

  9. #9
    Junior Member kmokzok's Avatar
    27
    Anyway, just barely in the incubator at the moment, I'm going to crank out some code this weekend to see what I can come up with.
    Should you come up with whatever particular don't be reluctant to discuss

  10. #10
    Junior Member Carmenentenadora's Avatar
    18
    OLD DOG,
    What's the POINT for this thread????
    Simply to reveal 2 charts?????????

    Best regards

    Dan

  •