Mechanical Trading Stocks

Discussion in 'Strategy Development' started by Murray Ruggiero, Sep 1, 2005.

Do you trade stocks or mutual funds using a mechanical systems ?

  1. Yes

    20 vote(s)
    76.9%
  2. No

    6 vote(s)
    23.1%
  1. Murray Ruggiero

    Murray Ruggiero ET Sponsor

    I would like to start a new thread about developing and testing systems for trading stocks. The world of developing mechanical systems for trading stocks is different than it is for commodities. One reason is that stock require real money, futures how much money you have available is never really an issue unless you are way overtrading. In equities you really can't use more than 2-1 leverage as an average trader. Another issue is that returns need to be reported in percent, while most trading platforms like TradeStation, report it in dollars.

    While many Futures traders trade baskets of markets and not having software which can backtest and optimize a portfolio is a big problem in stock, you must trade a basket and the size of the basket is not the 20-60 commodities, it is 100,500, 2000 or more stocks. You want consolidated results across the basket and you would like to optimize the systems parameters across the basket.

    The final problem relates to the fact that since you need to report performance in percent returns the kludge invented was split-adjusted data. Prices are divided by split ratio, so that you produce the correct split adjusted returns. The problem is if you subtract .01 for commissions for example on Microsoft in 1988 that is really $3.00-$4.00 a share unadjusted for commission. In addition lets suppose we wanted to use money management and buy $10000.00 of each stock, we would be buying $1,000,000 share of Microsoft at .11 in the 1980’s, which does not make any sense since the real price of the stock was over $30.00!. My research show that split adjust results produce error in backtesting of 200%-600%!. The work I have done shows that this is why many people believe that mechanical systems do not work on stocks because using split adjusted data , leads to these types of backtesting errors.

    I discuss these issues for in a free tutorial on my site. The link is

    http://tradersstudio.com/Default.aspx?tabid=126

    This tutorial includes the rules to a good trading system, which trades the Nasdaq 100 stocks , but you need to be registered on the site to access the complete document , including the rules for this system. The document can be downloaded as a pdf. Registration is free and only takes a few minutes. This will allow you to access much more content on our site which you cannot see if you are not registered and logged in.
     
  2. vikana

    vikana Moderator

    I have found that you need to handle stock splits the same way as futures contracts roll-over. You simply have to simulate with the prices the way they were at the time - there is no way around it.

    Back-adjusting futures or split-adjusting stocks will generally fool you, or at least significantly skew the test results.
     
  3. Murray Ruggiero

    Murray Ruggiero ET Sponsor

    Well, the back adjust data can not be used to calculate percentages. We really don't use the back adjust data to produce the equity stream. TradersStudio uses the backadjusted and the real price to create a equity stream and trade by trade which similate trading in real life, except if the split occurs when the position is being held. In this case it works as follows:

    Let suppose we buy a stock for 50.00 and it splits 2-1 and we exit long and go short for 26.00, we would list our exit at 52.00 and enter the the new position at 26.00.

    It is not perfect, but solves 99% of the problems caused by split adjusted data.

    This is a feature which is built into TradersStudio. We have what we call a TraderStudio stock contract , it is produced with split adjusted and unadjusted data. We plan to support dividends in our next version. When this happens you will use three data streams to adjust for both issues. TradersStudio will update these contracts by simply clicking on a menu which will update all the ones you have created, with s single click. This one click lets you update them after updating your data nightly.
     
  4. zenith

    zenith

    I agree with you on commissions. But besides that what you are saying doesn't make much sense: if we bought 1,000 shares of Microsoft at .11 and sold at 0.22 - it's a 100% gain and we'll have $10,000 profit. The real price was $30.00, so we would actually buy 330 shares, but if Microsoft went to $60.00 we make the same $10,000 profit. :confused:
     
  5. Murray Ruggiero

    Murray Ruggiero ET Sponsor

    Well, If you had 100,000 to trade a basket of lets say 10 stocks you can only put 10,000 in each one. If microsoft is .11 that a problem. You can do the portfiolo level testing with split adjusted data.
     
  6. zenith

    zenith

    Why exactly in your example Miscrosoft at .11 is a problem?

    Anyway, if it works for you then great...
     
  7. I have found that a certain "genre" of mechanical systems work quite well on baskets of stocks. By that I mean, they produce equity curves that show a pleasing compound annual growth rate and an acceptable depth & width of drawdown. Deliberately I phrase these as subjective human judgement criteria -- what pleases me and what I find acceptable, may not please YOU. My appetite for risk and my tolerance for pain, might not match yours. Therefore, perform your own testing and draw your own conclusions. They may or may not match mine.

    The "genre" of systems I'm talking about, treat conventional oscillator readings as contrary indicators. Specifically, the oscillators "RSI" and "Stochastics" and "Williams %R" give off excellent trading signals -- in reverse.

    I find that if a system goes long when the oscillator says "Overbought" and exits the position when the oscillator says "Oversold", nice profits are the result. The best arrangement seems to be something along these lines

    If the oscillator reading yesterday was extremely overbought, and the oscillator reading today is not quite so overbought, enter a long position on tomorrow's open.

    If the oscillator reading yesterday was extremely oversold, and the oscillator reading today is not quite so oversold, exit the long position on tomorrow's open.

    Using the Fast Stochastic K oscillator as an example (with phony numerical parameters):

    IF (MARKET-POSITION IS FLAT) AND (STO_K(YESTERDAY)>=95) AND (STO_K(TODAY)<95) THEN BUY TOMORROW AT MARKET

    IF(MARKET-POSITION IS LONG) AND (STO_K(YESTERDAY)<=5) AND (STO_K(TODAY)>5) THEN EXIT LONG TOMORROW AT MARKET

    I've tested these kinds of systems in the commercial software packages "Strata Search" and "Wealth Lab Developer", and the resulting equity curves are nice. In my opinion.
     
  8. Murray Ruggiero

    Murray Ruggiero ET Sponsor

    Because , if I am trading a basket using a given size account, I need to enter and exit at real prices, not split adjusted otherwise how can I know how many shares I can afford.
     
  9. vikana

    vikana Moderator

    I think you're making it too complicated. Why is there any difference between holding 100 shares at $100 or 200 shares at $50 ? From a total account perspective it's identical. The only issue is how to calculate commission and slip, which always has to be done on the real prices or normalized to take splits into account.

    I'm not sure there is anything complicated here :confused:
     
  10. Murray Ruggiero

    Murray Ruggiero ET Sponsor

    Well, The only difference is that after the trade is finish we want the entry and exit price to represent the real price, which is why we went to 26.00 on the second trade. When you apply money management to a portfiolo it makes a difference, you can't see it in a 2-1 split but in a 3-1 or 4-1 split it matters, because you can only buy whole shares and fractional share money goes to waste.
     
    #10     Sep 2, 2005