Last week, someone in a stock forum posted a comment requested for stocks in KLSE which break 52 weeks low. This is indeed a very popular rule, you might be able to get the list from newspaper or some other website. In this post, let's try to develop this scanner, it is only one line of code! Why not we create it ourselves?
The code is as below:
Filter = C < Ref(LLV(L, 260), -1);
That's it. C is close price, L is is low price. The function LLV is to find out lowest value of the bars in the period. The second parameter is period which is 260 days here. 260 days is number of working days in a years (deduct weekend). To make it simple we will not consider other market close days like public holiday. The value return from LLV(L, 260) is the lowest price in last 260 days (bars). Function Ref refers to previous one day of value of LLV(L, 260). If we read this line of code in plain English, it is - Get me list of stock where close price is lower than the lowest price in the previous period of 260 days from yesterday. This is exactly what we want - today price breaks the new low of previous 260 days.
In Amibroker, we will use "Explore" feature in analysis to run this code as custom formula, we will get 52 weeks low stocks list in just a few seconds.
The following is the screenshot of our 52 weeks low scanner Amibroker "Explore" result.
Note that, Amibroker also provide time frame related functions to compress daily bar to weekly bar so we can operate on weekly bars. I will let you guys to explore these functions if you are interested, you can post me a comment if you face any issue.
You can follow result of the 52 Weeks Low Scanner. I will update this result at least once per week.
No comments:
Post a Comment