1
$\begingroup$

I am an economic last year student trying to figure out how to backtest my model.

It consist on several requirements imposed to the stocks before buying them and a very simple exit strategy.

I first impose the condition to the stocks of showing improvement in the following parameters:

  • Return on Equity
  • Gross margin
  • Sales
  • Leverage
  • Being above its 200 daily arithmetic mean
  • Achieve at least three increasing minimums

Each company receives one point for each requirement accomplished, ranging from zero to six.

My idea is to make a regression between the returns of the stocks and the punctuation obtained in the test to see if there is a positive correlation.

I think that it may be very simple but since I just started in the quant finance it would be great to have some feedback and recommendations about how to improve my backtesting.

$\endgroup$
2
$\begingroup$

I think that it may be very simple but since I just started in the quant finance it would be great to have some feedback and recommendations about how to improve my backtesting.

From my experience, most who begin testing a model straight from academia overlook several things that are quite different in the real world. Factoring them in will help to make your model's test more accurate and will help you experience less variance when you take the step from simulation to live trading.

  1. Clean your data. In all my years I have never found a data source that is always clean. Have some code that combs through your data before you put it into a database. You will have to correct errant pieces of data by hand at times and it can be tedious and annoying but it is necessary.

  2. Factor in liquidity, slippage, commissions and financing costs to all your models. Portfolio's don't finance themselves, leverage is not free, commissions add up and you can't just buy or sell $1B of a security at a specific price just because your model wants to. Your execution price is the one at which someone else is willing to take the other side of your trade and it is often not your model's price.

  3. If you become satisfied with a model, congratulations but you are only half way done. You now have to determine how you are going to deploy it. By this I mean that you will need to determine how much of your portfolio you will put to work with this model. Will this model run 100% of your portfolio? Will it be mixed with other models? Does the risk/return/volatility profile of this model fit in with what you are trying to accomplish? These are questions that only you can answer personally and the answer will come via an optimization process that you choose or create.

Best of luck!

$\endgroup$
  • $\begingroup$ Hi, can you give an example of errant data? At the moment, I'm using historical end of the day closing prices from Yahoo for a machine learning project. How would I check if the data has errors? Thank you. $\endgroup$ – moondra Mar 13 '17 at 22:33
  • $\begingroup$ @moondra Hi. Yahoo data will usually (not always) give you the correct High and Low and Close but will may not give you the official Opening prices. It will just give you the first price it records at 9:30. It will also not have the correct total volume. Compare the Yahoo open for QQQ to official QQQ open prices. Off by 1 or 2 cents at least 1 or 2 days a week. $\endgroup$ – amdopt Mar 14 '17 at 13:59
  • $\begingroup$ Thanks did not know. I will compare the prices. $\endgroup$ – moondra Mar 14 '17 at 14:53
  • $\begingroup$ I will make sure that the data is homogeneus before moving forward. I did not even thought about the commissions and the other issues but it will really improve my work. Thank you amdopt! $\endgroup$ – Polo Mar 15 '17 at 13:49
  • $\begingroup$ You might look for prices of zero or prices that rise by more than 100% in a day, those are usually data errors. $\endgroup$ – noob2 Mar 15 '17 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.