I was thinking about writing my own backtester and I realize I have to make some assumptions. So I was hoping I could post what I am planning on doing and hopefully some of you can give me some ideas on how to make it better (I'm sure there is a lot that can be improved).
First of all, my strategy involves holding stocks for usually some days, I am not doing (probably any) intra-day trading.
So here is what I was thinking. First, I would buy some minute OHLC stock quotes covering the stocks I am interested in (thinking about buying some from pitrading.com, is their quality acceptable?). Then if the algorithm triggers a buy or sell at some bar, I would "execute" the order using the high or low of the very next bar (attempting to be as pessimistic as possible here). One thing I am curious about is bid/ask, so I was thinking about maybe adding/subtracting a few cents to take this into account when buying/selling. I would just see what these values have been recently (difference between bid/ask and quote for some recent data on these stocks and then just use these numbers as I wouldn't be backtesting that far back). I would assume that I can buy/sell all I want then at that price.
Lastly I would include the cost of commission in the trade. I would neglect any effect my trade would have on the market. Is there any rough guideline using volume to estimate how much you would have to buy/sell to have an effect?
I would also simulate stop-loss sell orders and they, too, would be executed at the next bar low after the price passed the threshold.
That's it, it will be pretty simple to implement. I am just hoping to make it conservative so it can give me some insight into how well my program works.
Any thoughts or criticisms about this program would be greatly appreciated. I am new at this and I am sure there are some details I am missing.
No comments:
Post a Comment