Stock splits vs backtesting

Discussion in 'Strategy Building' started by braincell, May 24, 2012.

  1. I'm sure some of you have encountered this problem when testing daily bars.

    For example MSFT goes down to a value of around 0.01 per share by 1986 if you account all of the splits. Then the backtester gets confused since it's max tick value is 0.01, so it can only place orders at 0.00 or 0.02 for example. In reality, the price was around $20, and there would be no problems placing orders at 0.01 intervals (or 1/8ths) in reality. This means that the backtester can (in the case of MSFT in 1986) only place orders at +/- 100% of the stock price. That won't work.

    The only realistic option I see is having the backtester detect stock splits via a separate database and know how to respond to it.

    If we keep increasing future values (and not past like now) from the splits (ie MSFT would be around $8000 per share now), we get a different problem as the spread and everything else would have to be artificially inflated or something. It's not workable.

    Questions:

    What are your experiences when working with daily data that goes that far back?
    Does anyone maybe convert the stock price to real dollar purchasing power or commodity index to smooth it out? What tricks could I use, short of forcing the backtester to detect the splits and react as it would in reality (which may be a lot of work)?

    Note: I have coded my own backtester.
     
  2. The same problem is present with intraday bars unless you exit at the end of the day.

    Welcome to real backtesting...

    Edit: you know what pisses me off the most with people like you? In other threads you appear like a heavy-duty expert about almost everything, from data-mining to spaceships for traders and now you suddenly ask a question that makes people like us who backtest many years wonder if you are for real. This problem has a few simple solutions. The fact that your are not familiar with them makes you a newbie to me. I will not help you here because you are not humble enough to deserve help. I hope you will understand.
     
  3. Uh, ok bill, thanks but no thanks. You have no idea what you're talking about. Same problem is present with end of day bars? Are you drunk right now? Maybe you didn't read my post.

    I've had no need to implement stock split fixes until now because of the data I was using. I now changed data and increased volumes of it. I have had in place methods for dealing with stock splits on intra-day charts and manually inputting dates when they happened. The backtests are and always have been really robust, where I did simulate shares increasing/decreasing in quantity. The problem now is I'm dealing with data that goes back to the 70s, vs data that was mostly 1hour bars going back to the 90s. Those are big differences that require me to automate this process.

    Yes it has a few simple solutions and all of them I am aware of, but you've probably never coded an app that needs to look at 1000s of stocks from a database and adjust a threaded backtester to work on each one and automatically detect not only splits but a bunch of other data. The differences in implementation are big, as you probably don't know. Also, the simple solutions you think about are probably not robust enough for my standards.

    It's not just one stock that splits and changes quantity.It's relations, correlations, indicator and floating point values vs integer formats, etc, problems you'd need a dictionary for.

    For example: the backtester can get one price data with splits. The indicators will need another where the prices are converted to floating points and divided back in time. Correlations need to be normalized again based on the splits. Three data sets vs one. Get it?

    Another problem is, if you designate that you want the bot to trade 100 shares of today's value, how many shares will it have been trading in 1976? Right you need to go back in splits and divide. But then how do you simulate commissions accurately, etc? I've implemented all of this already.

    I was asking for your opinions on my solutions, not asking what solutions you use. The discussion could have turned to what happens when we convert from using 1/8ths to 0.01s? If you need atomic precission you will re-code your backtester to work with 1/8ths when needed and put in a database that knows when to do it. That's what I'm doing.

    I see I didn't mention the major implied complexities in my post, other than stock splits. I should have known it's not implied, so I see how you think i'm a newbie. You were wrong though, so now maybe you will have something useful to contribute once you get your head around what the question really was.
     
  4. 2rosy

    2rosy

    its called corporate actions. you adjust for them
     
  5. It seems that braincell cannot deal with data in a proper way. Yet, braincell is an expert. Sounds too much of a contradiction to me.
     
  6. I'd be querying what your strategy's holding period will be, if you're using such a long time series .. then look at corporate actions, if you still have to.
     
  7. Braincell is trying to figure it out..
     
  8. Murray Ruggiero

    Murray Ruggiero Sponsor

    TradersStudio has built in analysis for handling splits and dividends. You need to use three data streams unadjusted,Split adjusted and dividend only adjusted. It will correctly handle splits dividends and allow orders at real prices. This allows correct money management for stocks and ETF's.

    Here is a link to a relative strength tutorial for stock and ETF trading.


    http://tradersstudio.com/Tutorials/StockRotationScreening.aspx
     
  9. Hi Murray, funny coincidence - you invented a system called Braincell , right?
     
  10. Murray Ruggiero

    Murray Ruggiero Sponsor

    Yes, it was a neural network which was embedded into a spreadsheet. I have nothing to do with Forum member Braincell.
     
    #10     May 29, 2012