li

Amibroker AFL to find 52-week High and Low of stocks – Scanner & Explorer

To get IEOD Data into Amibroker visit the link below:

http://tinyurl.com/ctzqcsy  

Here is the Amibroker AFL to find the stocks that hit 52-week High and low on the given date. AFL can be used both to scan the stocks and also to explore them. It is a simple AFL which takes only the trading days into its count while calculating 52-week high and low. You can also add required columns to be displayed in the explorer.

 

 

Here is the AFL to scan and explore 52-week High and Low of stocks:

_SECTION_BEGIN(“Price”);
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat(“{{NAME}} – {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}”, O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
 Plot( C, “Close”, ParamColor(“Color”, colorGreen ), styleNoTitle | ParamStyle(“Style”) | GetPriceStyle() );

HI = Close > Ref(HHV(High,260),-1);
 LW = Close < Ref(LLV(Low,260),-1); Filter = HI OR LW; AddColumn( Close > Ref(HHV(High,260),-1), “1 year High”, 1 );
 AddColumn( Close < Ref(LLV(Low,260),-1), “1 year Low”, 1 );
AddColumn( C, “Close”, 1.2 );

_SECTION_END();

With a slight modification in the above code you can get Highs and Lows of any time frame. Let’s say we want to find 2 year high and lows. Just replace 260 with 520.

But what is this 260 for 52 week calculation?

One week = 5 trading sessions.

1 year = 52 weeks = 52*5 = 260

2years = 104 weeks = 104*5 = 520

Accordingly you can get 18 month low or 30 month low. Just convert months into weeks and weeks into 5 trading sessions. You will get the desired result.

If you have any AFL that you want to share, you are always welcome.
Author of Analystcalls

Author of AnalystCalls. Have you checked my most viewed articles on how to download and configure Free EOD, IEOD & Real-time data of NSE, MCX into Amibroker? Here are the details [LINK] .

Be the first one to read quality articles of AnalystCalls by subscribing through email (free) and get them right into your Inbox [LINK]

Live Charts ▼ www.analystcalls.in/charts

NiftyBankNifty

ACCAMBUJA CEMAXISBANKBAJAJAUTOAIRTEL
BHELBPCLCAIRNCIPLACOALINDIA
DLFDRREDDYGAILGRASIMHCLTECH
HDFCHDFCBANKHEROMOTOCOHINDALCOHUL
ICICIBANKIDFCINFOSYSITCJINDALSTEEL
JP ASSOCIATESKOTAKBANKL&TM&MMARUTI
NTPCONGCPNBPOWERGRIDRANBAXY
RCOMRELIANCERELINFRARPOWERSAIL
SBISESAGOASIEMENSSTERLINGSUNPHARMA
TATA MOTORSTATA POWERTATA STEELTCSWIPRO

p

7 Comments

  1. abhaydagli says:

    Hi Priya

    How r u?
    Please from where i can download AMIBROKER AFL SOFTWARE,.

    Please let me know the proper steps & procedure for the same.

    Thanx
    Abhay Dagli

  2. EDGER says:

    HI,
    As I use amibroker , i wish the scan could be done as it triggers that means if Sesa Goa triggers at 9.30 and Aban trigger at 10am it should come in the time wise order whether it be buy or sell.

    Now what is happening it is coming in A to Z series and it is in no way helping in intraday. Another point is if the charts could get the date as it triggers would be an added advantage.

    Could you get the AFL to 1. having the trigger on time wise and 2 the pop up
    Thanks if it could be done

  3. giten says:

    namasker madamji, please send macd cross over scaner, & i am intrested lern tecnical then please send other afl & tec elc book, thank you,my cell no is 9699931031,

  4. pt singh says:

    i m using your given afl for 52 week high low, it gives error when i used for automatic anakysis ( syntex error in line # 1). Please advice me further

  5. pt singh says:

    Hi,

    I need your help in getting afl for open high low close , so htat to run this afl in automatic analysis

    please guide me, if you can, I shall be greatful to you

0 Trackbacks

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

4264 k