Intraday strategy using first hour High/Low

Dear All,
I am just starting with amibroker AFL coding and need some help with coding my strategy.
All help will be greatly appreciated , I have been using this strategy manually but I want to automate the signals so that anyone can do it. So here goes :slightly_smiling_face:
This is an intraday strategy and we only take maximum 1 or 2 trades per day using this , we have been able to get consistent returns on a weekly basis with this strategy .
To start , we don’t take any trades for the first 1 hr.
We are using the 5 M chart
After the first 1 Hr we mark the High (Define name HRH) and the Low (Define name HRL) of the first 1 HR.
Signals are generated in the chart after the high and low has been marked.
Entry Signal - If price is above HRH buy signal is generated and if Price is below HRL Sell signal is generated. Preferably marked with a Blue up arrow for buy and Blue Down Arrow for sell.
How to enter- Buy order 2 ticks above the high of the signal candle - Buy to Be marked with a Green Up Arrow
Sell order 2 ticks below the low of the signal candle - Sell to Be marked with a Red Down Arrow
Profit target - 10 ticks above buy price / 10 Ticks below sell price - Preferrably marked on the chart once entry order is executed
Stop Loss - 5 Ticks below Buy Price / 5 Ticks above sell price - Preferably marked on the chart once entry order is executed.

Please folks all your help will be greatly appreciated and I believe reading the code will be very helpful in understanding how to code my strategies.

“Need help with AFL” is not a proper thread subject.
Imagine everybody would start threads like that.
You have still 5 minutes left to change it (15 minutes overall edit timer).
So use it to think about a better one.
This is a high quality forum but not some generic “I don’t care” junk forum.

Hi ,
Thank you for the reply.

I see @tomasz has alread updated the post title , I was late to do it.
I was not expecting such a quick reply from the mods, Had been using ninja trader for about 3 months and did not receive replies from mods anywhere less than 5-6 hrs.

Thank you , I am loving the amibroker software already.
Have a good one !

Hi All,
Now I have been going through the tutorials and the operators and functions , Looks easy , almost excel like , and have also tried the AFL Wizard.
The Afl Wizard looks promising , and the AlertIF functions is cool !
I was able to make simple strategies using EMA , CCI and RSI.

But there is still a long way to go before I might be able to make an afl for my strategy all on my own.

Hoping that someone will help with this soon.
Thanks and warm regards,


The type of strategy you’ve described is called “Opening Range Breakout”, or “ORB”. If you google “ORB Amibroker”, you will find one of the results is this. The code listed there seems to be written for the Indian stock market from my first glance. You will need to read it and with the help of the Amibroker online manual (again, Google all the terms/functions you don’t know to get to the relevant section faster) and make it work for your market.


This will help you get started for the lines. You need to figure buy and sell signal part

Dear friends,

I need AFL with RSI with popup alerts at 60 BUY & At 40 SELL
Can any friend help me on this.