The winning rate usually is not high but if you manage to catch some of the shares which the trends extended for long time, the profit will be more than enough to cover your loss in other trades.
Let's implement a Amibroker trend scanner in this post, yes it should be up-trend to be exact because we can only trade long in KLSE.
The code is as below:
uptrend = C > EMA(C, 30) AND EMA(C, 30) > MA(C, 50) AND MA(C, 50) > MA(C, 200);
decentVolume = (MA(V, 20) * C) > 3500;
priceRange = C >= 0.5 AND C <= 1.5;
Filter = uptrend AND decentVolume AND priceRange;
The scanner consists of only 4 lines of code. As I explained in other post before, C represents close price and V represents volume in Amibroker. First line of code filters the stocks which are in short, medium and long term up trend. We do this by mainly using moving average with different periods. The code should be self explanatory. Of cause moving average is only one of the simplest way to identify trends, you can using any other indicator or technique which is suitable.
Second line of code is just an extra filter to make sure the shares we filtered are trading with good volume so that they are liquid enough to trade. Third line of code filters the price range of the share, in this example, we are only interested in share between RM 0.5 to RM 1.5.
Last line of code combines all of the conditions together and assigns it to Filter variable which will be used by Amibroker exploration feature to filter the stocks.
No comments:
Post a Comment