# Issues when backtesting the top 200 stocks in Amibroker



## JJZ (11 March 2016)

Sorry for the newbie question, but whats the best way to backtest/optimize in amibroker using the top200 stocks?  

From my reading on this forum the ASX200 is adjusted quarterly meaning the longer I go back in my testing more inaccurate the results are. Is this correct, I am using Norgates Premium Data if that makes any difference.

If I apply a  filter to select (roughly) the top 200 stocks based on average turnover the system really slows down with all the extra number crunching involved.

Is there a better way? am I missing something obvious?


Thanks
JJZ


----------



## Roller_1 (11 March 2016)

in the analysis window where you do backtests click on the filter button and select ASX200 watchlist... on this site http://www.asxmarketwatch.com/ there is some good info for beginners learning amibroker


----------



## JJZ (11 March 2016)

Roller_1 said:


> in the analysis window where you do backtests click on the filter button and select ASX200 watchlist... on this site http://www.asxmarketwatch.com/ there is some good info for beginners learning amibroker




Hi Roller_1, checkout this thread. I will explain the reason for my issue using the current ASX200. 

https://www.aussiestockforums.com/forums/showthread.php?t=28059&highlight=backtesting


----------



## AlterEgo (12 March 2016)

Hi JJZ,

I’m sure there are many different opinions on system testing, however in my opinion, I wouldn’t restrict myself to just the top200 stocks for optimization, or for say, testing if an idea works or not. To find the optimum parameters, you really want a fairly large amount of data to test it on, so that your system tests have a lot of trades in them. Using too small a data set for optimization, in my opinion, will give a result that is probably not going to be statistically significant, as the number of trades generated by the system test is probably going to be fairly low.

If an idea works, then it should work on the majority of stocks, not just the top200. If someone showed me a system that only worked on the top200, but didn’t work on a universe outside of the top200, then I would say the system has been curve fitted and would not work in real trading.

However, if I had already developed a system, and wanted to see how it would perform if I only traded it on the top200, then I would use the method that you already have tried, using some sort of average turnover filter to filter the market down to roughly 200 stocks. I really can’t see how a simple calculation like this would slow Amibroker down to any noticeable degree. In any case, I would expect this test to show far less profit than if run over a larger trade universe, as the larger the trade universe, the more trades would be generated and therefore should also have a larger level of system exposure.


----------



## ajcode (13 March 2016)

I see topics like this popping up every now and then on ASF. Seems to generate a lot of discussion. So how do we solve the problem of getting the correct constituents for each quarter till the beginning of market time?

I guess another really big question is "how many delisted securities that make up the constituents over time are being stored in your database?" If the answer is not many then this makes backtesting many years of data rather pointless.

Assuming that you have all the delisted securities and find it difficult to obtain the ASX constituents over time, then how can we best approximate these constituents using only the date, open, high, low, close & volume?

Well from googling over the internet, I found a neat paragraph in IndexMethodology_24May05.pdf that mentions liquidity playing a part in the index calculation saying this:

"Relative liquidity = stock median liquidity/market liquidity

Stock median liquidity is the median daily liquidity for each stock over six
months. Daily liquidity for each stock is the daily value traded divided by
dayend market capitalisation adjusted for free float."

This part caught my eye, because what if we could approximate the constituents by ranking stocks by their 6 month median turnover (close x volume), re-calculating/re-balancing all stocks on the close of 3rd friday of December, March, June and September. So what I'm saying is for 3 months, stocks maintain the same ranking and then on close of the third friday of each quarter specifed above, we re-calculate/re-balance them based on their 6 month median turnover. This can be performed on a metastock database with delisted securities because the Open Interest field is only used for futures not stocks. It would be a pain in the butt, but doable (probably wreck your hard drive).

What are peoples thoughts on that? Waste of time, Hall of Fame or Holy Grail 

Could be an interesting future project for me to work on.

Cheers,

Andrew.


----------



## Roller_1 (13 March 2016)

ajcode said:


> What are peoples thoughts on that? Waste of time, Hall of Fame or Holy Grail




As Richard from Premium Data has stated on another thread, later this year they will have a product to combat survivorship/ historical constituents issues. So that will probably be the most accurate way


----------



## Sir Burr (13 March 2016)

Doesn't this already cover it?

http://www.premiumdata.net/support/amibroker-alphatester.php


----------

