Range Breakout Amibroker Exploration with Buy Sell Levels

Breakout of a trading range is considered as one of the most accurate methods for taking positions in the market. It implies strengthening of the momentum and heavy participation in the direction where breakout happens. In this post, we’ll explore a range breakout Amibroker exploration which will show you the exact price point where you can place buy/sell orders. Also, you’ll know the stop loss and targets for both buy and sell positions.

In case you missed it, we have also posted an Excel sheet for the same breakout strategy. Please find it here.

Range Breakout Amibroker Exploration – Overview

This exploration is based on the average 5-day range of the instrument. On an intraday timeframe, if the price crosses above or below this range, you should take positions.

This is an intraday only strategy where you’ll find the buy/sell levels for each day at market open. You should take trades as per the levels and close all open positions at EOD.

Below are some of the important columns from the exploration:

  1. Buy Above – The price above which you can place Buy order
  2. Sell Below – The price below which you can place Sell (Short) order
  3. Buy SL – Stop loss for Buy position
  4. Sell SL – Stop loss for Sell position
  5. Buy Target (1,2,3) – 3 Targets for Buy position
  6. Sell Target (1,2,3) – 3 Targets for Sell position

Range Breakout Amibroker Exploration – Download Link

You may download the exploration code form below link. The file is in zip format, you’ll have to unzip it before use

Range breakout AFL Exploration Code

The code has been tested in Amibroker version 6 and above. You may download the trial version of Amibroker form this link

How to use this Exploration Code?

Step 1: Open Amibroker, Click on File–>New–>Formula and Copy Paste the exploration code you downloaded.

Step 2: Click on File–>New–>Analysis. Set time frame to Daily.

Step 3: In the “Apply to” drop-down select ‘All symbols’ or filter based on the list of stocks you want to watch. In the range drop-down, select ‘1 recent day(s)’ to run exploration only for the current day. And select the AFL code in the “Formula” box

Exploration settings

Step 4: Click on Explore Button. You will see the list of stocks with buy sell levels and targets.

Exploration Results

Note –  You’ll need a real-time data subscription to use this exploration as the levels are calculated based on current day’s open price.

Also Read: A Simple Multi Timeframe Trading Strategy with Exploration AFL

Understanding the Exploration Code

The code is fairly simple where day’s range and average 5 days range using the below formulas:

Range Breakout Amibroker Exploration 1

The day’s range is the minimum among the difference between High price and Open price and Open price and Low price.

The AddColumn() function adds these values to the exploration result.

Next, the BuyAbove and SellBelow variables are calculated. It implies the breakout price above/below which you have to take the position.

Buy stoploss (BuySL) is the same as SellBelow and Sell stoploss (SellSL) is the same as BuyAbove.

Range Breakout Amibroker Exploration 2

The logic is that if the CMP crosses above the sum of open price and average 5 days range, then you have to place BUY order.

Similarly, if the CMP crosses below the difference of open price and average 5 days range, then you have to place SELL order.

Finally, the buy and sell targets are calculated and added to the exploration.

Range Breakout Amibroker Exploration 3

The first Buy target is the summation of Buy price and average 5 days range. The second target is the summation of first buy target and average 5 days range and so on. For simplicity, we have added just 3 targets but you can add more continuing the same logic.

Vice versa applies for Sell targets.


All the AFL’s posted in this section are for learning purpose. Trading Tuitions does not necessarily own these AFL’s and we don’t have any intellectual property rights on them. We might copy useful AFL’s from public forums and post it in this section in a presentable format. The intent is not to copy anybody’s work but to share knowledge. If you find any misleading or non-reproducible content then please inform us at support@tradingtuitions.com

Related Posts


  1. Thanks for the article, Could you please provide AFL for this indicator, Thx!!

  2. Thanks for the AFL ! which time frame preferred for this afl? Can we use Daily Time frame for this AFL?

    Admin i have another Doubt ! Earlier u provided same strategy in Excel format in Daily time frame ! Is That Excel Strategy only for Delivary based Trading? or we can use it in Intraday too??

  3. Hello, Could you please help me to enable this for viewing the levels for historical data.

Leave a Reply

Your email address will not be published.