Amibroker is a financial software for portfolio-level system design, testing and validation. It has its own scripting language AFL.
Questions tagged [amibroker]
75 questions
7
votes
4 answers
Read Amibroker price volume data using python
I would like to read the price volume data of Amibroker stock symbols using python. I cannot find anything useful on google for doing this. Anyone can help?

guagay_wk
- 26,337
- 54
- 186
- 295
5
votes
1 answer
How to get profit percentage of trade during backtest in Amibroker
I am using Amibroker v6.3
I would like to find out the profit percentage of a trade taken during backtest, then adjust the sell criteria accordingly. When profit is below 10%, I want to use this function sell_below10(). When profit is >10%, then use…

user3848207
- 3,737
- 17
- 59
- 104
4
votes
1 answer
Scale in buying positions in Amibroker backtesting
I have a simple backtesting code in Amibroker. It looks something like this;
Buy = BuySignal();
Sell = SellSignal();
My equity is $10000.
This code works but the limitation is that when it buys, the entire equity $10000 is sunk into the buy. What…

user3848207
- 3,737
- 17
- 59
- 104
3
votes
1 answer
Assign past values of array using array method in Amibroker
I would like to assign past 8 bars of array BB with false value when current bar of array AA is true. This is the code I wrote;
for( i = 8; i < BarCount; i++)
{
if (AA[i] == True)
{
BB[i] = False;
BB[i-1] = False;
…

user3848207
- 3,737
- 17
- 59
- 104
1
vote
1 answer
Move profit target and stop loss after initial profit target is hit in amibroker
I have the following amibroker afl backtesting code with stop-loss set at 10 points and profit target set at 20 points.
long_entry_condition = close > EMA(close, 50);
Buy = long_entry_condition;
BuyPrice = Close;
risk =…

user3848207
- 3,737
- 17
- 59
- 104
1
vote
1 answer
Python Error 99 while integrating Amibroker with Python
I am trying to integrate Amibroker 6.41 (64-bit) with Python. Currently, I have Python 3.11.1 (64-bit) stand-alone installed along with NumPy, and pandas installed using pip in the python library.
I have installed AmiPy.dll into the Amibroker plugin…

Wyatt_Earp
- 43
- 7
1
vote
1 answer
Amibroker AFL: How to plot Custom Anchored VWAP (AVWAP) passing any specific date to it
Below is the code for Anchored VWAP which will select Date based on my mouse click, my query is how to plot Anchored VWAP passing date as a parameter, so it will be constant across all symbols.
Eg: I want to pass "2021-03-26" as Date parameter so it…

Jay
- 71
- 6
1
vote
1 answer
Unable to understand the following line of code : use of dist = 1.5*ATR(10); and inside for loop it is used as an array
Here dist is a variable but inside the for loop its used as an array in afl programming
dist = 1.5*ATR(10);
for(i = 0;i < BarCount; i++ )
{
if( Buy[i] ) PlotText( "Buy\n@" + C[ i ], i, L[ i ]-dist[i], colorGreen );
if( Sell[i]…

Vivek Patel
- 43
- 7
1
vote
5 answers
For loop doesn’t accept array. How to work around for this Amibroker code?
The following code will calculate the high-low range in percentage of certain bars when an event occurred and calculate the average of the high-low range.
event_up = get_event_up();
event_down = get_event_low();
num_events_in_range =…

user3848207
- 3,737
- 17
- 59
- 104
1
vote
0 answers
Make this Amibroker code that counts the number of times a certain event happened in the past more elegant
I have the following code for function count_event to count the number of times a certain condition related to an event happened in the past.
The problem with this code is it manually gets the information regarding each event one by one. It manually…

user3848207
- 3,737
- 17
- 59
- 104
1
vote
2 answers
Unable to add this custom metric to Amibroker backtest report
I would like to add an extra column to indicate volatility in the backtest report.
Here is my code. The extra column volatility_recent appears but no value appears in the column. However, if I were to use the commented line trade.AddCustomMetric(…

guagay_wk
- 26,337
- 54
- 186
- 295
1
vote
1 answer
Create array of same value in Amibroker
I would like to create an array of same value in Amibroker. The array should look like this;
Arr_fix[0] = 80;
Arr_fix[1] = 80;
Arr_fix[2] = 80;
...
Arr_fix[n] = 80; //n is LAST_VALUE of array

user3848207
- 3,737
- 17
- 59
- 104
1
vote
1 answer
JavaScript ActiveXObject is not defined in browser console
I would like to ask wether this ActivexObject can be accessible using web server through PHP. Because when I include the javascript, it shows that the activexobject is not defined(when using browser), while in edge/ie11 it says "SCRIPT429:…

Alex Yamin
- 55
- 2
- 9
1
vote
2 answers
How to show buy/sell signals of Amibroker on my webpage?
I want to show the buy/sell signals that Amibroker generates on my website. I tried lot of things but I couldn't find a solution.
It would be even better if I can stream the charts to the website.
The problem is, I don't know how to access the API…

cyberyod
- 11
- 1
- 3
0
votes
0 answers
52 week High in Date Range in Amibroker
I have a working Amibroker formula which finds stocks which made 52 week high during a period. But this works on the look back period. I provide the number of days to look back.
I want to create the same thing but instead of the look back period it…

pradeep
- 13
- 7