Automated Recognition of Interesting Price Trends - my software

Discussion in 'Trading Software' started by mglomba, Nov 19, 2011.

  1. mglomba



    I am a software engineer but also interested in practical data mining of financial time series (did MSc and dropped out of PhD in this subject).

    I have became tired of analyzing individual charts and reports looking for mid-term investment opportunities and last evening finally decided to create a simple thing for myself, now made it public:

    The tool automatically analyzes price trends of multiple financial instruments on daily basis, allowing you to discover strong and stable price movements that might become interesting investment opportunities. Trend stability metric is calculated for each financial instrument which is then classified as stable, crazy or chaos - a greater value means a stronger, more stable trend.

    Hope you will find it useful too, for me the selection process is now must easier.

  2. maxpi


    That is kind of cool. :cool:

    Thanks :)
  3. You say:

    EURSEC stable
    USDSEC stable

    But then

    EURUSD crazy?

    How come two stable variables when devided produce a crazy variable?

    Maybe do you want to start by explaining this one?

    I don't discount in advance that you may have a good explanation.
  4. mglomba


    Hi Intrabill,

    Thanks for your questions, they are absolutely valid.

    First, please note that classification into "stable", "crazy" and "chaos" is completely bespoke and based on the stability metric range, however the numerical value of metric should actually indicate how price movements of a given instrument are stable comparing to others. The higher the metric is the less the price trend is disturbed by fluctuations and the metric is itself is not normalized to trend angle. So really, the goal for strongtrends is to recognize past price trends with minimal fluctuations.

    Now let's say we have three virtual currency pairs (with perfect relative price efficiency between them): E/S (green line), U/S (red line) and E/U (blue line)
    And this would be a plot of their recent price movements:

    As we see, the green E/S pair has minimal fluctuations, the red U/S is greatly disturbed and blue E/U is definitely the most "chaotic" one.

    It is also important the metric is not calculated from tick data but is based on some sampling of recent price values what may result in some small inefficiences. That is why it's just a handy "accessory tool", not a full blown trading system, nor a Holy Grail as well. As I wrote in the disclaimer: you make your own luck.

    And I wish you good luck!
  5. Thanks for your explanation but this is not related to my question. In my question you have a stable divided by a stable and you get a crazy.

    In the example you gave you have a crazy divided by a crazy and due to phase shift you get mode cancellation and a stable line.

    I wouldn't have asked you the question if that was the case.
  6. hey michal,

    so do you use eod data for your calculations? where do you get the data from and is it accurate? like does your program pull the data to make the calculations? for example, say you use yahoo finance for quotes, there have been moments where they were wrong about somethings, but corrected them later. does your website do the calculations when i open it on my browser or does it do it at a specified time and then publishes it to your website?
  7. mglomba


    Oh, I think I see your point now - if you think about EURSEK, USDSEK and EURUSD particularly and the difference between trend metrics between them the case is slightly more difficult and needs more background as: a) the software builds a statistical model between price and time, b) the value between 0 and 100 indicates how well the model predicts the price on the basis of time, c) zero means that price cannot be predicted from time using generated model, d) the actual "fit" depends on the model nature itself but for flat sideways "trends" it is always more difficult to find a sensible match with simple models.

    I don't think I have addressed your question fully with the above, I can only say that the data used underneath is fine and the discussed difference is not because of price inefficiencies between pairs (as always - there are some tiny).

    Practically, without going into raw numbers, one can visually evaluate on their own whether USDSEK goes up more steadily than EURUSD is supposed to go down recently.

    And one more disclaimer - please note that there is no ultimate metric that will indicate how stable a trend is - obviously this is because we are trying to compress a whole time series into a single number and this must be a lossy compression, so we always won't reflect the curve shape perfectly. Instruments marked as "stable" are not buy/sell recommendations (and no information on this website is any recommendation), I don't even think a tool like that can be used as a part of an automated trading system - it is just way too simple. The only driver behind building this piece of code was that I was tired with everyday charts review and just wanted to have a simple prescreening tool for myself. I have made it public to other lazy discretionary trend followers like me but any investment decisions should be made on your own really.

  8. mglomba


    The data is as accurate as it is possible, e.g. forex market is a bit distributed as you know, but I don't think any small errors really bias the calculated trend strength one way or the other. The calculation is executed on regular basis on the server and cached for the website, so nothing runs in your browser really.

  9. Wait... why should it be stable?

    Let's suppose (x/y) and (x/z) are both simple trend processes:

    (x/y) = t * a + e1 where t is the linear trend and a is the beta to that trend, and e1 is a random variable
    (x/z) = t * b + e2 where e2 is not e1, but also random.

    Obviously, both are stable trends.

    Now, (x/y)/(x/z) = z/y = (t*a+e1)/(t*b+e2)

    Clearly, this is not as straight forward as being a trending process too despite its two components are.

    In fact, is x/y and x/z are PERFECTLY trending, then e1 = e2 = 0; Then,

    z/y = t*a / t*b = a/b = perfectly level - NO trend at all.

    Thus, I think the original guy's program actually passes the smell test here. The ratio of two stable trending process should be a chaotic process.

    (I hope I didn't give away the OP's secret sauce here :)

  10. cool, may I ask what is your source for data?
    #10     Nov 21, 2011