Is it possible to find Open High Low Close for every candle in 5 min chart?

Hi All,
I am wondering if it is possible to store Open High Low Close of candle 1 in a variable/array of lets say a 5 min chart and compare it with candle 2 Open High Low Close?

I am in my learning phase and any guidance would be appreciated.

Thanx in advance

1 Like

Ok seems I found my answer, Finding answers are awfully hard on internet as not much resources are available.

So I will answer the question I asked myself. If anyone other newb like me has a similar question
answer is
BarCount is a numeric variable that holds just one number (the count of elements in array).

So basically my printf is printing not bars in chart, but giving me a count of elements inside an array.

I understand that over 800 000 articles:


... almost 32 000 posts on this forum:


... and hundreds or thousands of articles on AmiBroker's website: are not enough for you :cry:

Probably all you need in this case is a Ref() function

But you should really start from learning basics of AFL (Amibrokef formula language) before drawing next wrong conclusions. You've got plenty of materials available.

1 Like

Thanx for reply awilson. One on my questions got answered by looking at that thread. I gave it a read but it does not tell me how to do it. It does explain well how arrays are stored though. So let me clarify here. I assume that amibroker is picking up data from some table where these values are already stored. So lets say if I want to compare OHLC values of each candles? What would be more wise to pick from file or to store in an element or array like its shown in link and then use it for comparison purposes with other candles?

In both cases any pre written codes already available? I have used search box and it doesn't pull up anything similar that I could read or use.

Thanx in advance

Hey Milo

800,000 resources but I am new and learning to use it. This could be a perfect case of information flowing over the top. I could use some basic info like how to use functions with examples and proper syntax etc.

You will find all you need in the latest AmiBroker 6.30 User's Guide:

Don't expect from other users rewritting what has been written in the manual. It simply makes no sense ...

1 Like

@Sunny /MSD1979,
Assuming you are using Amibroker for the first time , obviously you are using the trial version and that is why perhaps your basic query arose because trial version does not allow you to STORE/Save the Data Base (the table as you call it)

So I suggest you start with study of Amibroker Data Base/s ,how to create them, how to import Live/EOD data to them how to save them how to use them, manipulate them etc .
Hint: To save the OHLCV values when you are in Trial version you have to manually save a spare copy of the data base before every time you close your trial version Amibroker .

Yes its already pre packed, its called the Price.AFL ,just open a new chart and drag that Price.Afl from a list of such pre packed AFLs listed on the left side of your chart.


Ok thanx Bro. Yes I am using Ami for first time.

_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", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );


This is what I can see on Amibroker. Now I would like to compare first candle Open High Low Close with second candle Open high low close. So lets say if Second Candle High is greater then first candle high I would like to mark a small circle on top of second candle high . Then I would like to compare 2nd candle with 3rd candle and do some marking accordingly.

Hope I am not asking too much. I could not find this code in the amibroker reference guide.

What does this line mean? What does lookback period for pivot mean? what are values 5 2 50 and 1 for?

When I print SV_LP it always print 4, why?

SV_LP=Param("Lookback Period for pivot?",5,2,50,1);


Some more progress made so far

Now I tried to use above functions

x=Low < Ref( Low , -1 );
This has plotted break of low on chart.

My questions here might be too basic for you guys, So I am sorry and thankful in advance if anyone can help

My understanding of these 2 lines are
If low of current candle is less then low of previous candle then to put something in x
when I plot x it exactly prints where it should

In this case what does x hold? When I use printf("x %g", x); it shows me always 0 in interpreter window?

Also will x only hold 0 since only if the statement is true we want something to go in x?