Here is a simple AFL code snippet to plot One Previous Day High Low and currently day One hourly high low (i.e high between 9:15a.m – 10:15a.m as per NSE timings)
Previous Day High Low AFL code
To compute Previous days high-low values we need to use TimeFrameGetPrice function as shown below. TimeFrameGetPrice basically retrive the O,H,L,C values from other timeframes and in this case it is Daily timeframe and the same values are plotted in lower timeframes.
DayH = TimeFrameGetPrice(“H”, inDaily, -1);
DayL = TimeFrameGetPrice(“L”, inDaily, -1);
Nifty Spot showing Previous day High-Low
Download Previous day High Low Amibroker AFL code[wp_ad_camp_5]
Current day’s One Hour High-Low
To get Current days’ first one hour high and low we need to use timebased functions like timenum() and finally ORBH and ORBL captures the first one hour high and low. And you can change the timings mentioned below the suit your exhchange and your requirements.
OST=091500; //Observation Start Time
OET=101500; //Observation End Time
Currtime =TimeNum(); //get current time
ob_end = Cross(TimeNum(),OET); //detect the observation end time
ob_st = Cross(TimeNum(),OST); //detect the observation start time
Highest_since = HighestSince(ob_st,H,1); //capture the 1 hour high
Lowest_since = LowestSince(ob_st,L,1); //capture the 1 hour low
ORBH = ValueWhen(ob_end ,Highest_since,1); //
ORBL = ValueWhen(ob_end ,Lowest_since,1);
Nifty Spot showing Current Day’s One Hour High-Low
24 Replies to “Code Snippet : One Hour High-Low and Previous Day…”
Thanks for the AFL. Please tell me how to incorporate previous day close also and how to make the line thick. This will be very much hepful. same thing for hourly also please. Expecting your reply.
Thanks & Regards,
To incorporate previous day close along with thick lines add the following codes to your AFL. styleThick in plot function represents thicker lines
Sir, Any similar indicator/script for metatrader.
As of now i dont have such indicators in MT4. Once i figure out will post you here.
Thanks again. I have incorporated and it comes but I want the line thickness still more. I tried to incorporate stylethick =4 but still it is thin. How to do very thick- please guide. It will be helpful.
Thanks & Regards,
Very good AFL Rajandran
want to request just add 2 more thing if possible
“add open and close line also of p.day”
its better to trade with candlestick pattern forms around these levels
done that thanks for AFL
You are welcome!
I have applied the AFL but i cant see the hrly high low line on price chart…
Can see plain price chart
sir i am new to the amibroker software will u please guide me through this
May i know what kind of Assistance you are looking for with respect to amibroker?
sir i need eod data for mcx from 1 jan till now for amibroker in txt file where i can get .. my getbhavcopy data downloader software didnt downloading the eod data for mcx now how to download the same if it is possible i need it for eod charts in amibroker pls guide..
It is not working for mcx
am planning to give 30 days trial to my clients regarding the buy and sell signal in my own statergy. what should be added to the code to protect them from viewing the formula and closing the signal exactly after 30 days of trial Kindly guide
Try with .Net SDK for Amibroker and you have to convert your afl to dll. If you are not a programmer then you have to depend upon some .NET based expert freelancer who is equally good in Trading system creation.
sir i want to scan stocks when they cross previous day high or low.
please provide required afl sir
I want to create exploration based on hourly high or low afl. I want to scan the stocks that have crossed first hour high or low. Could you please help
Dear sir .
i am using amibroker 5.6 newar show howerly chart .
plz help me.
Thanks & Regards
Can you set parameters if I want to close all Open trades by intraday (say 3.15 pm )
Can you set code and update me ?
Regarding AFL for previous day high-low indicator, I am in need of an indicator that plots PDH and PDL line excluding tail of PDH and PDL.
How to incorporate it in AFL.
May I request you to modify this AFL to display historic 1 hour high and low also please.
Hi Rajandran ,
how to plot high and low of a particular interval say interval of 13:00;00 to 15;30;00 of previous day on the current day.
it would be of great help. Thanks
I m using Amibroker 5.90 version. Previous day HL is displayed but today open range High Low is not displayed. Can you please clarify me, is it version issue or any other thing.
PLEASE GIVE ME AFL CODING FOR “5 MINUTE CANDLE BRAKEOUT”