Australian (ASX) Stock Market Forum

Amibroker FAQ

Yes - that's right. Is there an easy way to count the number of bars between certain points in Amibroker?

Ta :)
 
Depends whether you want number of bars (ie. days the stock traded) or number of calendar days.

Number of bars is easy. If your bar indices are called "first" and "last":

bi = BarIndex();
count = bi[last] - bi[first];

Calendar days is trickier. See this AmiBroker knowledge base article.

GP
 
Does anyone know how to export the data file from Amibroker? Eg. i have hourly FX data that i want to export to a notepad or a csv file, but i cannot find the file through Amibroker. Perhaps i'll just try and search the directories?

CanOz
 
There's several ways to do this in AB:

1/There's an export.js script in the Amibroker scripts folder that you can run.

2/There's an export AFL in the library that Kaveman has written.

http://www.amibroker.com/library/detail.php?id=327

3/Using an exploration AFL is another way to output data to a CSV file. Scroll down to the "examples" on this page:

http://www.amibroker.com/guide/h_exploration.html

Each option has it's advantages and disadvantages and each will probably require some adjustments to achieve the output you require.
 
There's several ways to do this in AB:

1/There's an export.js script in the Amibroker scripts folder that you can run.

2/There's an export AFL in the library that Kaveman has written.

http://www.amibroker.com/library/detail.php?id=327

3/Using an exploration AFL is another way to output data to a CSV file. Scroll down to the "examples" on this page:

http://www.amibroker.com/guide/h_exploration.html

Each option has it's advantages and disadvantages and each will probably require some adjustments to achieve the output you require.

Aaaayyyye! Cool Cap'En, I'll give it a whirl later.

Cheers,


CanOz
 
Hey guys,

I'm trying to get amibroker to calculate the volume of the XAO through the Composites Recalculation tool, but I get negative values on some of the dates. Does anyone know why?
 
I don't know why, but I noticed the same thing some time ago.

If you want to learn scripting, you could write a simple script to fix it.

GP
 
Calculating Fixed Fractional Position Sizing in Amibroker

Apologies for the simple question but can anyone clarify how to define this in Amibroker?

Looking through the AB helpfiles, I have found the following example code:

Buy = <your buy formula here>
Sell = 0; // selling only by stop

TrailStopAmount = 2 * ATR( 20 );
Capital = 100000;

Risk = 0.01*Capital;
PositionSize = (Risk/TrailStopAmount)*BuyPrice;
ApplyStop( 2, 2, TrailStopAmount, 1 );


What confuses me is that the Capital variable in the above example seems to be a fixed value of $100000, whereas in reality the actual current Equity value should be used in the calculation.

Consequently, is there any way to reference the current Equity value instead?

In additional if anyone uses a different approach for calculating Fixed Fractional Position Sizing (and is willing to post it) I'd be really interested......

Many Thanks in advance.....
 
I think you'd need to do the stop calculation in the custom backtester to use current equity instead of initial capital.

And you need to be aware that ATR(20) could well be a bit different when calculated in the backtester than when calculated in the main code, due to differences in days traded (ie. bar alignment happens in the backtester). If it's a liquid stock though that trades every day, then the difference may not matter much.

GP
 
Aaaayyyye! Cool Cap'En, I'll give it a whirl later.

Cheers,


CanOz

For anyone interested in exporting data, the second option as Captain Black has linked, written by Kaveman works really really well, and so easy that even i figured it out!

Cheers,

CanOz
 
I think you'd need to do the stop calculation in the custom backtester to use current equity instead of initial capital.

And you need to be aware that ATR(20) could well be a bit different when calculated in the backtester than when calculated in the main code, due to differences in days traded (ie. bar alignment happens in the backtester). If it's a liquid stock though that trades every day, then the difference may not matter much.

GP

Hi GP,

Thanks for the feedback especially about the potential problems encountered with ATR in backtesting....

Cheers,

Chorlton
 
Ok, I'll give this question one more try.
I have a database with 1 minute data. (Database settings intraday, 1 minute.)
I want to run an Analysis (Explore) using the 1 minute bars, but whatever I try, it doesn't work.
Here's my very basic test: Display volume for each minute.
Simple code:
Filter=1;
AddColumn(Volume, "Volume",1);
Run Explore
I don't get Volume by minute, just by day, like this:
Ticker Date/Time Volume
CL0309 31/01/2009 00:00:00 137145
CL0309 2/02/2009 10:01:00 AM 12536
CL0309 3/02/2009 00:00:00 146872

If I add TimeframeSet(in1Minute) - no difference.

Try every possible permutation of TimeframeCompress, TimeframeExpand, TimeframeSet - no difference.

However, I can use and write indicators that display perfectly based on 1 minute bars, 3 minute bars, whatever I fancy, using Timeframeset. :confused:
I'm obviously missing something really really basic.
Please help.
 
Anyone ever trouble with Amibroker not auto updating with Esignal before? I have seen this problem with TG and fixed it with the little"~" before the symbol, but after being through all the help files i'm stuffed if i know what it is causing the issue????

CanOz
 
Ok I'm back to my Amibroker puter.
This is what I see in in the Analysis window.
Pray tell me, where's the bar period setting, because I can't see it...
 

Attachments

  • Ami.jpg
    Ami.jpg
    131.8 KB · Views: 2
Click on Settings in the analysis window
Click on the periodicity drop down box in backtest settings.
 

Attachments

  • Backtester Periodicity Setttings.jpg
    Backtester Periodicity Setttings.jpg
    107 KB · Views: 4
Yes! Thanks kaveman and lesm. Never occurred to me to change backtest settings for explore. :rolleyes:
 
Top