Milktrader

Iterating Until Convergence

Wednesday, July 21, 2010

Random Trade System: A Thought Experiment

The programming and setup of this experiment will take some effort on my part, but it is not impossible nor insurmountable by any means. Eventually I will report the results. For now, let me detail the experiment.

--1 Choose a tradeable product (SPY, for instance)
--2 Enter Long at the Open on Day n (n=1)
--3 Set Target at 1 ATR
--4 Set Stop at 3 ATR
--5 Close trade based on whichever occurs first.
--6 Record PnL and trade duration
--7 Enter Long at the Open on Day n=2
--8 Repeat steps 3-6 (ie, target, stop, close trade, record results)
--9 Repeat steps 7,8 for m Days (take 10 years worth for starters)
--10 Repeat steps 2-9 for Shorts.

Once the data is in on the experiment, the results can be analyzed. Does the long side make money or lose money and what is its expectancy? Same question for the short side. This data on its own doesn't do much more than answer the question of whether a monkey can make money in the markets. But this is not the point of the thought experiment. We're not out to prove that "Ha, ha, a monkey can make more money than a professional money manager." This may or may not be true. We don't really care though. We care about the behavior and nature of a risk-based trading system. And a new way of thinking about benchmarks.

Note 1: in real life, you would need p number of long accounts and q number of short accounts so as to not interfere with existing trades.

Note 2: this data is particularly well-suited to a Monte Carlo (scramble the card deck) simulation. I can't wait.


7 comments:

  1. I would have thought of setting the limit at 3ATR instead of the stop...
    ReplyDelete
  2. The reason for the 3 ATR stop is to give the limit a better chance of hitting first. In a completely random universe, the 1 ATR limit should get filled before the 3 ATR stop. You clearly need it to hit 4 times for every stopped out trade to have a mathematical edge.

    This is in contrast to the popular risk one to make three trade.
    ReplyDelete
  3. Interesting...... I've been reading your blog since a couple weeks ago and find what you are doing is very much like what I would want to do some day if I can find the right tools. If you can provide a little more details, I may be able to run something on my side and compare notes.
    ReplyDelete
  4. If you are interested in developing trading systems, there are a few off-the-shelf packages you may be interested in looking into.

    I don't use but have heard AmiBroker (under $300) is a decent program. It's built on top of C++ as I understand so can do brute force fairly quickly. I've used TradersStudio ($500) in the past but it's currently undergoing some major rewrites to get away from its Visual Basic roots and is in a state of "beta". Also, if you can afford $3,000, you may look into TraderBlox.

    If you get a copy of Technical Analysis of Stocks and Commodities, you'll see sample code from even more vendors.

    My dream is to develop my own R package to do some basic system research. True money management is a bit more complex and is handled in varying degrees of effectiveness with the above programs mentioned.

    Good luck.
    ReplyDelete
  5. In fact I'm a young, not very brilliant software engineer interested in investing. I have access to Wealth-lab because I made enough trade from Fidelity (perhaps a hundred in the past year). The thing I like it is that I can write C# (a C/C++ variant from Microsoft, and which I use every day in my day job) to do the back testing. I played with wealth-lab a couple time and haven't picked up since then. One reason being my small account size, and second, I was really looking for direct data feed so I can play with those in a custom program or Excel alone - these data feed could cost maybe a couple thousand dollars which I cannot afford.

    Thanks for the pointers to the softwares. I took a look at the websites and found TradersStudio very similar to Wealth-lab. I'll keep these in mind. What's a R package by the way?
    ReplyDelete
  6. @fix R is a very robust statistical software package that is open-source. Widely used amongst quants and the like, it is particularly geared for data mining and statistical analysis. Very much recommend checking it out. You can create R functions that call C functions, so it is flexible. It's a similar language to Python, if you've done any Python.

    Careful though, you'll get hooked and Excel will be relegated to grocery lists and the like.
    ReplyDelete
  7. So is this what you're referring to?
    http://www.r-project.org/
    Looks like matlab to me. Will definitely take a look at that. Thanks!
    ReplyDelete