The following conversation was conducted on the old Chartist Traders Forum. This type of conversation is now run through The Chartist Community. Traders share ideas and help each other solve problems they are experiencing with their trading and, in this case, coding their trading system.
Question: I am trying to design a liquidity filter / position size algorithm that will give me a good chance of getting filled with minimal effect on market price. These are my current thoughts:
// Initial liquidity filter
// Average turnover over a 30 day period is > $250K
Turnover = MA(close * Volume, 30);
Buy = Turnover > 250000;
// Position sizing
PositionSize = equity / 8; // Divide equity into 8 equal parcels.
MaxPositionSize = Turnover * 0.02; // Max position size is 2% of average turnover
if(MaxPositionSize < PositionSize) // Is maximum position size < parcel size?
PositionSize = MaxPositionSize;
My current strategy raises a few questions:
1. One of the problems with the above is how Turnover is calculated. Because there are infrequent days where extreme volume occurs this can significantly distort the Turnover figure, which leads to taking position sizes higher than desired. One way I have considered to overcome this is remove any data point that > 2 standard devs from the average. Does this seem a good solution, or are there better ways to handle such situations?
2. Would 2% of average daily turnover be a good number and ensure there is minimal affect on price?
3. Considering my average trade length is 4 days is an average daily turnover over a period 30 days sensible? Since I will be selling very quickly, one thought is that maybe I should only look at the last 5 days as an average?
4. Are there better ways to do what I am trying to achieve?
5. I did try another approach described by Victor on this forum which looked at: average daily turnover / average daily ticks = $per tick and then your maximum position size is a % of $per tick. Victor originally suggested 20%. I see the logic of the solution, however, in my opinion this approach has flaws, especially when dealing with stocks that only have a tick range of 2-3 per day, which a lot of lower prices stocks do. What happens is when you have a lower amount of ticks you are increase your % of the average daily turnover, to a maximum of 20% if there was only 1 tick.
Would 2% of average daily turnover be a good number and ensure there is minimal effect on price?
Unless you're last name is Soros then I think you will be okay. For my managed accounts I limit it to 10% of the 7 day average.
Due to the short term nature of the system I need to minimise slippage. Another approach to remove the volume extremes that I thought of is to do a 5 bar moving average of volume*close - then take the lowest average across the last 30 days?
It really depends on what types of stocks you're trading. There are certainly some anomalies of volume over the course of a week. Sometimes a stock trades 500k for 3 straight days then trades 75k for the next two. Traded volume is different to liquidity. It could be there was enough depth in the stock but nobody was crossing the spread. I think a better gauge is looking at the depth. Otherwise play it very safe and stay with stocks that far exceed the minimum requirements. Even for longer term systems I don't go below 500k volume, so shorter term is worse. Perhaps stay with average volume exceeding 1m and turnover also exceeding $1m.
This would work if you wanted a "safe" blanket approach. But if I used such criteria it would remove quite a few of the ASX300, and would definitely hit the profitability of my system. I think you can reduce these limits if you proportionally reduce your position size, and that is what I have done. After many hours of consideration, and head scratching I have come up with a solution that I think will work. I thought I would put it out there for discussion. It is quite an interesting topic and there is definitely no blanket rule for solving the problem.
I believe the problem is two fold
1) Define a liquidity filter to remove illiquid stocks from my ASX300 universe
2) Define the maximum position size based on the liquidity of the stock. I want to ensure that the trade I place will be filled, with minimum slippage, and that I don't affect the price.
Number 1 - Liquidity Filter
The basic logic is -
MinVol = 150000; // Minimum volume
MinPrice = 5; // Minimum price threshold for MinVol
MinTurnover = MinVol * MinPrice; // Minimum turnover
AvTurnover = MA(C*V, 30);
AvVolume = MA(V, 30);
Buy = Buy And AvTurnover > MinTurnover;
Buy = Buy and AvVolume > MinVol;
This logic says that include stocks with a average vol > 150K and average turnover > $750K. I am yet to land on my preferred MinVol and MinPrice, but so far I think 150K and 5 is safe when used in conjunction with the max position size. Interested on peoples thoughts here?
Number 2 - Max Position Size
The logic for determining maximum position size is -
MATurnoverPos = MA(V*C, 5);
MaxPosSize = LLV(MATurnoverPos, 30) * 0.03;
A 5 point MA of turnover is created. I then look back over the last 30 days of the 5 point ma turnover and pull back the lowest value. I then take 3% of this turnover value as my position size. I have found this approach eliminates a lot of the problems when volume spikes occur, and gives me a relatively safe position size where I it can be filled. I feel relatively confident that this approach will work - what do others think? Is 150K volume, $750K TO too low still, even with the position size approach?
Is it necessary to have a Turnover filter and a Volume filter or just one or the other.
If I make the system a weekly system what is a reasonable figure to use? Assume that my average position will be 10k and I have 20 positions. I have read that my position should not exceed 5% of average turnover. On that basis Turnover needs to be a min of 200K. Now if this system is weekly and I want to be able to exit a position in one day then I assume then that the "average weekly turnover" needs to be 5 lots of 200K or 1 million. Can anyone that trades weekly systems please give me some guidance on what works in reality. I tried turnover = 1 million and volume = 1 million and it really restricts the purchase of stocks less than a dollar.
3. What length of time would the "average" be? 13 weeks?
When the weekly volume is greater than 1.5 million in many cases the turnover is less than 1.5 million so when the two filters are combined it will make it even more restricted. I need to find out what a "workable" number is for a weekly system for volume and turnover and do I need to filter for both? I can’t find much on weekly systems at all. With daily systems a lot of traders seem to just have a turnover filter set at 200K and no volume filter at all or they will buy up to 8% of average weekly turnover.
Remember that if you use a static amount and you test a long way back you may need to historically adjust the volume by a CPI component. Volumes/turnover today may well be larger than what they were in the 90's. My experience is that larger clients tend to use turnover rather than volumes. Also, the lookback is arbitrary. We use 7 days, but I think Gary Stone uses a year.
So if I just filter for turnover and remove the volume filter then what would be a reasonable figure? 200K daily or 1 million weekly or more?
Will depend on your account size and the style of trading you're doing. If it’s shorter term then slippage plays a much more important role and must be addressed in testing. Longer term is not so much of an issue. Usually I set a limit to trading 10% of the average turnover, although at times I do go over that and I finesse the orders. Start with 200k and work from there. If you find slippage is an issue then move it up a notch.
I decided to have a look to see how liquidity has changed since 1997 and yes it does seem that a CPI adjusted filter is needed for accurate back testing. Average Turnover even back in 2000 was below 500000 for a weekly system. By testing today with a Turnover filter set at 1 million (Weekly system) it does restrict the results considerably.
I have set the weekly turnover to 1 million for 2013 and it reduces by 8% per year
TurnoverFilter = 1000000 * ( 0.92 ^ ( 2013 - Year() ) ); //turnover decreases by 8% per year
Weekly turnover filter values if set at 0.92
Is there a way to confirm that the figures are approximately correct. I may have to adjust the % decrease. This may not be the correct way to find out but I did a "explore" in Amibroker with the dates set at 2/3/2000 -3/3/2000 and of the 551 symbols in the Small Ords , 220 were less than 338253 weekly turnover and 331 were greater. Is there a better way to confirm that these values are reasonably accurate?
Amibroker users may find this useful.
I have written this afl so that the actual turnover filter "setting" is displayed on the screen and the actual stocks turnover is also displayed. When the actual turnover is greater than the Turnover setting it is green and if it is less then it's red. It is useful when testing to get an indication of what the turnover filter is set at for a given year and how the stocks turnover compares to that setting.
TF = 1000000 * ( 0.92 ^ ( 2013 - Year() ) ); //turnover decreases by 8% per year
GfxSetTextAlign( 0 );
GfxSelectFont("Tahoma", 10,400, False );
GfxTextOut("Average Turnover "+ NumToStr(AverageTO, 0.0) ,5, 30 );
GfxTextOut("Turnover Filter Setting "+ NumToStr(TF, 0.0) ,5, 50 );
Join The Chartist trading community and chat with traders.