Market Simulations - Interacting Strategies

Discussion in 'Strategy Building' started by BinaryMan, Jul 4, 2008.

  1. I wrote a simple program to model a market with 4 trader strategies (screenshot included):

    1. Fundamental analysis
    2. Trend followers
    3. Counter-trend followers
    4. Noise traders (to maintain market activity)

    The strategies are simple but each trader (500 in this example) has a different threshold for when to buy, when to take profit, and when to sell at a loss within their general strategy. The result is often unexpected price patterns (the price moves based on the balance of trade).

    One interesting scenario is when all participants are fully invested in the stock (including fundamental analysts). It will peak, dip a bit, get a second wind from the counter-trend traders, then the market will fail completely and drop like a rock. No matter what the paper value of the traders, when the money runs out the stock cannot maintain its price. This result relates to economic principles as well as how people balance their portfolio by redistributing assets. The example is a bit extreme, but it can help to explain general market cycles in terms of capital distribution.

    Another scenario is a volatile/illiquid market (I increase the price response to trade imbalances). The trend traders invest heavily when this occurs, making the bubble worse. Although fundamental analysts normally won't chase this beyond a certain point, large fund investors and others certainly do in the real markets. Greed creates the bubble, and fear causes the crash.

    I can model more specific strategies if anyone would like to give suggestions on what to put against each other. It would be interesting to see what general strategy works under what conditions. I can also probably model limit orders and market microstructure if I can get something more specific.
     
  2. There's a few similar scenarios covered in "origin of wealth." It's a layman's book on modern quantitative non-linear research on financial markets, but the research looks interesting.

    Check it out when you get the chance.

    An interesting scenario I'd like to see is to model a "house" that has practically infinite capital and can see all the other players positions. Model something like 20 players, each with a finite amount of capital to start with. The players can not see each other's positions, nor the house. They can only observe the price action of the index they are all trading. They can also make independent fractional bets and do not have to bet each period.

    The job of the house is to move the price index either way by betting some amount of capital such that the aggregate bets of all players moves the index change/period proportional to the total bet magnitude and direction per period. The house must also do this in such a way, as to wipe out the players as quickly as possible.

    The question is, what is the optimal strategy for an independent player to bet against the participants under the above conditions. Could have a few players with objective strategies (TA/fund/whatever) and some random.

    The house would ultimately win as their capital and information access will beat all, but at any given point in time, they will try to wipe out the most players.
    Thus an independent player would possibly have a chance to find some strategy to outlast the others (something like parando's paradox).

    Would need to see monte carlo type runs of the scenario, and an explanation of why the optimal strategy was optimal (this is ideal of course).

    Anyways, if you wanted to try to run something like that, it would be interesting to see.

    dtrader
     
  3. That type of scenario sounds a lot like some of the academic papers and simulations I've read (awhile back, foggy on the details). I'm actually trying to do it based on real-life market structure (such as NASDAQ or NYSE model, or at least supporting limit orders) and evolving trader strategies as they get wiped out or optimize to the market.

    My intuition is that most traders use simple order types (buy at market), but modeling liquidity requires some traders with a limit order strategy (otherwise only the market makers absorb orders; we know this is not entirely true, but the portion of ECN trades varies widely and doesn't exist in some securities; also, can't market makers place orders on ECNs too? Transparency and all that...)

    One important factor is what the market composition really is. For instance, relatively inactive investors like for retirement accounts vs. managed accounts that rebalance vs. active traders vs. fund managers who have legal requirments/restrictions. How many people buy and hold vs. how many are active in trading the float for real. Basically part of the puzzle is the activity distribution with respect to time, and how much volume each type generates. They also have different complex triggers such as value trading, market timing, news reaction, technical trading, or emotional trading/gambling/guessing.

    My goal is not actually to model "rational participants". Rather, competing strategies that represent more realistic behavioral distributions. For instance, is most of the daily volume daytrading or technical trading? Are most of the big moves caused by large investors coupled with news traders or value traders? From even my academic reading, the market is inefficient simply because rational/informed investors have no purpose in fighting noise/news/random traders. As you might observe from charts, trends and cycles are more common than flat, stagnant markets because movement prompts more movement and it's self-propelling to the point where rational investors take their profits and get out. Only when external money/interest dries up does the stock tend to fall (in general terms).
     
  4. Here is an example of price response when all participants are noise traders (long trades only, no strategy, small random chance each cycle to buy or sell if have holdings).