Here is a simple afl code which scans for 52 week High and Low in Amibroker software.
Following Filter Parameters used:
HI = Close > Ref(HHV(High,260),-1);
LW = Close < Ref(LLV(Low,260),-1);
i.e scan the list of stocks whose Last Trading Price(Close value) should be greater than the Higher High value of past 260 trading sessions/Candles,which is nothing but 52 week High or Last Trading Price(Close value) should be lesser than the Lower Low value of past 260 trading sessions/Candleswhich is nothing but 52 week High
Here the value 260 is choosed as a approximation value that out of 365 days in a year, Saturdays and Sundays alone contribute to 52×2=104 days. So as an approximation 260 is taken as a rounded value to find out 52 Week High/Low from the list of stocks.
Download 52 Week High/Low AFL here – While saving save this file as .afl file
Scanning results from my NSE EOD Pack
52 Week High and Low NSE Stocks
Ticker | Date/Time | 52 Week High | 52 Week Low | Close |
---|---|---|---|---|
AGCNET | 8/20/2010 | 0 | 1 | 226.05 |
BAJAJCORP | 8/20/2010 | 0 | 1 | 726.5 |
HBLPOWER | 8/20/2010 | 0 | 1 | 24.7 |
HCC | 8/20/2010 | 0 | 1 | 64.35 |
JAYSREETEA | 8/20/2010 | 0 | 1 | 159.95 |
KLGSYSTEL | 8/20/2010 | 0 | 1 | 92.6 |
REDINGTON | 8/20/2010 | 0 | 1 | 82.3 |
TELEDATAIT | 8/20/2010 | 0 | 1 | 1.65 |
AARVEEDEN | 8/20/2010 | 1 | 0 | 91.45 |
ASIL | 8/20/2010 | 1 | 0 | 4.1 |
ATUL | 8/20/2010 | 1 | 0 | 135.45 |
BAJAUTOFIN | 8/20/2010 | 1 | 0 | 635 |
BASML | 8/20/2010 | 1 | 0 | 146.75 |
CLNINDIA | 8/20/2010 | 1 | 0 | 719.5 |
CORPBANK | 8/20/2010 | 1 | 0 | 628.85 |
DCB | 8/20/2010 | 1 | 0 | 54.75 |
EXCELCROP | 8/20/2010 | 1 | 0 | 259.9 |
EXIDEIND | 8/20/2010 | 1 | 0 | 147.6 |
GEINDSYS | 8/20/2010 | 1 | 0 | 161.65 |
HDFCMFGETF | 8/20/2010 | 1 | 0 | 1860.95 |
HITECHGEAR | 8/20/2010 | 1 | 0 | 207.65 |
ICIL | 8/20/2010 | 1 | 0 | 19.45 |
INDSWFTLAB | 8/20/2010 | 1 | 0 | 93.95 |
INDSWFTLTD | 8/20/2010 | 1 | 0 | 39.45 |
IRB | 8/20/2010 | 1 | 0 | 303 |
JBCHEPHARM | 8/20/2010 | 1 | 0 | 111 |
JETAIRWAYS | 8/20/2010 | 1 | 0 | 818.25 |
JINDALPOLY | 8/20/2010 | 1 | 0 | 637.4 |
JUBLFOOD | 8/20/2010 | 1 | 0 | 538.9 |
KARURVYSYA | 8/20/2010 | 1 | 0 | 681.5 |
LAKSHVILAS | 8/20/2010 | 1 | 0 | 125.4 |
MALWACOTT | 8/20/2010 | 1 | 0 | 56.05 |
NATCOPHARM | 8/20/2010 | 1 | 0 | 221.9 |
NSEMIDCAP | 8/20/2010 | 1 | 0 | 8930.85 |
ORIENTBANK | 8/20/2010 | 1 | 0 | 444.65 |
PATSPINLTD | 8/20/2010 | 1 | 0 | 15.05 |
RPGLIFE | 8/20/2010 | 1 | 0 | 110.35 |
RSWM | 8/20/2010 | 1 | 0 | 152.7 |
SAREGAMA | 8/20/2010 | 1 | 0 | 157.35 |
SARLAPOLY | 8/20/2010 | 1 | 0 | 140.1 |
SHIVAMAUTO | 8/20/2010 | 1 | 0 | 145.5 |
SKSMICRO | 8/20/2010 | 1 | 0 | 1215.9 |
SOBHA | 8/20/2010 | 1 | 0 | 387.6 |
SPMLINFRA | 8/20/2010 | 1 | 0 | 234.5 |
SURAJDIAMN | 8/20/2010 | 1 | 0 | 66.85 |
SURYAPHARM | 8/20/2010 | 1 | 0 | 229.05 |
SUTLEJTEX | 8/20/2010 | 1 | 0 | 227.7 |
TTL | 8/20/2010 | 1 | 0 | 39.1 |
WOCKPHARMA | 8/20/2010 | 1 | 0 | 247.15 |
Great AFL Code, Searching for this long time.
Thanks
Dear Rjendran,
Thank you.
Veer
Dear Rajendran,
I am looking for a AFL that extract Open,High,Low,Close and Volume for hourly / half-hourly time frame during intra-day. It shall be for all scripts that is available in Amibroker currently. The extraction shall be exported into an Excel file. Do you have / use such AFL? If so, please give the link.
Thanks & Regards,
Veer
@Veer,
Here is a way to export the data from amibroker database and save it as a csv file.
http://www.marketcalls.in/2009/11/backup-you-amibroker-eod-database-in-csv-format.html
This can be used both for EOD and IEOD data.
thanks for such code when i add this afl and scan it shows error “MISSING BUY/SELL VARIABLE ASSIGNMENT” can anybody tell how to solve this error. as i have just started using ami broker.
@slakh
I think you tried to scan using this afl code instead try with the explore option in the Automatic Analysis window
Dear Raj,
sometime back,u wrote afl for intraday trading using 5 high and low ema’s. not able to trace that now..cld u post the link please
tks n best
sri
Dear Rajendran,
Thank you,
Veer
add to that rsi and then follow the rising rsi from 52wk low and declining rsi on 52 wk high rest you can figure out
Dear Rajendran,
Can you pls provide me the link of AFL code for Point & Figure charting with box size as variable(i.e user can change the box size).
Regards,
Veer
Thanks Rajendran,
Your website is really informational and there is always a new thing to learn about whenever I visit it.
Keep up the good work and Thanks a lot.
Gopikrishna.
Hi,
How can I download the code?
hiii,
i can not download the afl.can somebody help me?
thanks
Problem Fixed.Try now
thanks Rajandran R
Thanks for the code. Is it possible to modify the code such that the Number of new highs minus the number of new lows (NH-NL)ca be plotted as a histogram in a separate window.
Dear Rajandran
Thx for your excellent work to help the trading community.
Understand that “Pin bar candlle” is also an excellent indicator to trade.
May I, therefore request you to provide a scan for the same.
It would be ideal if it is added to the existing candle identication AFL already avlbl.
Thx again
Brgds
Ravi
Ravi,
Thanks for the suggetion. Will try it out
Rajandran R
Dear Rajendra Sir,
I found one very interesting thing at below link
http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:high-low_index
Which is The High-Low Index is a breadth indicator based on Record High Percent
Calculation of this index is as below
Record High Percent = {New 52 week Highs / (New 52 week Highs + New 52 week Lows)} x 100
High-Low Index = 10-day SMA of Record High Percent.
Sir This is very good overlay indicator in stockcharts but only give SP500 and other foreign index.
Can you please convert this into afl and post in marktcalls. There is no such indicator on the web in any charting software.
Dear Rajendra Sir,
i am new to alf plz let me know alf for BUY = LAST PRICE > PREVIOUS 2 CANDLE HHV WITH STOPLOSS OF 1% AND TRALING STOPLOSS %
Hello Sir,
I am trying to create a multi year high screener.
Issue 1:
Is there a way to compare between 52W high and 104high. If the answer is Yes compare with 156 weeks rates.
Issue 2:
If the price cross above the price which was high 3 years back but below price which is 2 years high eg
2014 price 100 2015 price 150 today if it cross 100 we want it to be highlighted.
Your guidance in the matter will be highly useful.
I have been using this 52 week high Low scanner since long. I need to get the summary of the stock names with number of times new 52 week high or low was made. The dates will be put in the From/To date in analysis window. The output would be like this.
Stock High Low
AAA 10
BBB 5
CCC 2 and so on.
Thanks in advance.