Hmm. Nice code. It works well.
Most liked posts in thread: Stock Ranking
Currently, I have more of my funds than usual in index funds, along with direct investing. So it's still a form of AB testing, since the results will inform my allocation percentages going forward.
So in this case, yes, I take the top few "best ideas" for my direct investing, and my best ETF idea for my ETF portion.
You can assign any value to a position score. One that has worked best for me is price (lowest first):
That will list the lowest first. I also have a price and volume filter as I don't want illiquid penny stocks.Code:
PositionScorer = 100 - Close; PositionScore = Ref( PositionScorer, -1 );
Not all systems will be best with that kind of ranking. Some systems would have the highest prices better, or RSI, perhaps the highest ROC or maybe the highest ADX. A combination of these could also be good.
I've tried to google some useful ranking methods for AB that others have used, but I personally haven't found much.
As a disclaimer, I didn't come up with the code but found it. However it is one that I use often when I test positionscore. Glad it's been useful for everyone
This is my price filter. I vary it depending on the system. A volume filter for me would usually go a little different.Code:
PriceF = Close > 0.05 AND Close < 10;
VolumeFilter = Volume > 300000;Code:
VolumeMA = MA(Volume, 20); VolumeFilter = Volume > VolumeMA;
@qldfrog yea I get your point. Though I think the minimum price filter works even back in the past as the premise is: a 5c stock will gain more momentum than a $20 share. Both can gain 40% but the smaller one is more likely to gain that momentum quicker. And you are right about the definition of penny stocks. Hard to backtest for but adding a volume filter is likely to help in excluding the penny stocks.
Almost on topic - a few ranking methods I have collected over time. All worth back testing.
- IBD200 relative Strength. IBD200 is a subscription service and covers the US markets but there is a TC2000 formula that can be used to run a similar RS scan on the ASX at the Stockbee site. https://stockbee.blogspot.com/2007/05/ibd-200.html It is basically a weighted average of price growth for one quarter, half year, 3 quarters and a year. So more suited to longer term trades or a weekly system.
- SCTR (Stock Charts Technical Rank)
- Bang for buck (Nick Radge)
- %Risk Filter (Nick Radge)
- Historical volatility. Try starting with the lookback window set to your average trade holding period.
If you're using AB one way you can do it is via PositionScore. Let's just say for simplicity you rank your buy signals based in RSI. In AB you just set PositionScore to equal RSI and it will enter positions based on RSI--those positions with the highest ranking (RSI) will be taken initially. There are a few things to be careful of when using PositionScore in AB but that's a simple way of taking into account ranking in AB.