One reason that the price series may apeare too random is that complete randomness is inherent to the series that you are generating.

Like you have mentioned, I think what one expects when looking at something like a price series is some order.

The one way, that I can think of, to get around this problem would be to actually keep track of history. Your "direction" and "variance" functions are totally independent of whats been happening prior to now.

I dont know too much about how the markets work but one thing I can think of, off hand, is the following This should also take care of the "crash" or "boom" as the price will grow or drop more drastically as it moves in a particular direction.

I like to think of this as the market getting more unstable as it moves in a particular direction for too long. Of course this could be a fundamentally wrong assumption but like I said I understand less of the markets than I would like to.

Of course, so far the assumption is that both the variance and the direction get reset once the direction changes. This need not be the case. It might be better to start with a high probability of moving in a particular direction and then reduce that as the price moves along that direction for too long. Also instead of a complete reset one might want to increase the variance exponentially and reduce it linearly (or the other way round).

Finally - and I find this to be useful when trying to simulate real word phenomenon - one could actually base this fictitious price index on an actual one. It need not be a direct correlation, it could be inverse or a combination of multiple real word stock indices. Of course the simulation can even draw from historical data!!




In reply to Re: Generating Stock Price Data by tmharish
in thread Generating Stock Price Data by TeraMarv

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.