Home » Blog » Platforms » Amibroker » How To Write Simple Amibroker Buy Sell Indicators?

How To Write Simple Amibroker Buy Sell Indicators?

Amibroker Buy Sell Indicators

In my previous content, I wrote about Simple AFL Code Writing. There I gave guidance on how to create a buy-sell signal on your own. Today, we are going to discuss one of the easiest topics based on Amibroker Buy-Sell indicators. As you know in Amibroker, there is a customizable facility available for traders. That means, traders can customize, modified or create certain instructions by applying codes. There is a separate formula editor window where Amibroker users can put their own formula to create an indicator. Hence, today we will cover the process to write Simple Amibroker Buy Sell Indicators.

Today, we will work on an MA or Moving Average. It is a momentum oscillator, builds a correlation between price and MA. In Amibroker, you can find varieties of charting tool options along with customizable benefits. In order to create a buy-sell signal, you need to follow certain steps and procedure which are described below:

How To Write Simple Amibroker Buy Sell Indicators

There are two possible ways by which traders can create their own signals and indicators. One is drag and drops way and the other is by writing an individual formula. Today we will cover the second one. In order to make the topic more prominent, I attach an image of the Amibroker AFL buy-sell signal, created by me.

amibroker buy sell indicators

The above chart is on MA (Moving Average), based on a daily chart. The signal I have created, that indicates if MA crosses above 200 level, the trend is bullish while below 200 considers as bearish. The formula is attached below:

Amibroker AFL

As you can see in the above screenshot, the formula is on the buy-sell signal. You can also write down your own formula in the formula editor option. In case, if any mistake happens while writing down a formula, it will give you an error signal so that you can understand your mistake.

Let’s Start

The process is quite easy. You just need to be comfortable in creating your own formula. If you want you can copy the formula from below:

0 0 votes
Article Rating
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Newest Most Voted
Inline Feedbacks
View all comments

respected sir..when time frame is change moving avg.level also change.is it possible when i change MA timeframe(1day to 15min)MA value is same for all timeframe(1day,15min,5min)


Hi Indrajit Sir, I am getting the following error while verifying syntax shared above in Line 2, col 22:
Unexpected end, expecting ‘)’ or ‘,’
(Error 31. Syntax error, expecting
Occurs The syntax is incorrect because the parser expects specific tokens and finds something else)
Kindly help me in dealing with the same


Hello Indrajit,

Need a help in AFL, how can I get the dates of high low of last month, I am able to get values but not dates, could you help

MonthH = TimeFrameGetPrice(“H”, inMonthly);

MonthL = TimeFrameGetPrice(“L”, inMonthly);

AddColumn(monthH, “M-H”, 1.2);AddColumn(MonthL, “M-L”, 1.2);

Do you think you can kindly help me with code to get dates of these monthly high low.




Last month with dates; if possible current month also; or I should be able to change to month as required