Export Data from Amibroker to ASCII files

#1
Export Data from Amibroker to ASCII files

Here there is a formula available to export data from Amibroker to ASCII files. With the formula we can export data for a specified period from Amibroker database.

How to export:

Download,unzip and copy this afl formula file to Amibroker\Formulas\Custom folder.
Scan with the formula in Automatic Analyser (AA) in Amibroker.
The formula will create a folder in C drive named 'OHLC' and will collecte the data in separate text files for each symbol.

Periodicity:

WE can export the data for different periodicity 1min, 5min, 10min or daily etc. as we required. To configure that go to AA > settings > General > Periodicity and set periodicity. Thus we can get data for 5min, 10min, 1 Hour, daily etc.

Select Date Range:

To set the date range, we have to edit the formula.
Open AA > pick (the formula file) > edit.
In the second line we can see:

Buy = ( (DateNum() >= 1061225) AND (DateNum() <= 1070110) );

First DateNum is the start date and second DateNum is end date.
The current settings will export data from 20061225 to 20070110.
Just like that, we can select another date range. Instead of 2006, should give 106 and for 2007, give 107 etc. Month and date are same. Save the formula and scan it.
It will export and save the data in C:\OHLC folder.
If you want to export for an another date range, that will also be added to the corresponding files just after the current data.

Hello Traders,

I request you to use this formula and let me know the feedback.

Thanking you,
Regards,
Pramod.
[email protected]
 

rkgoyal_98

Well-Known Member
#4
Dear Soumya
Hello,
Yes it is possible
Just change 2 things

1. In the file open instead of Name(), use the file whatever u want ie 31012007.txt
2. Use a instead of w

It will read like this
fh = fopen( "C:\\IntradayData\\31012007.txt", "a");
it may need that file is opened before the loops and header line also added before the loop starts

I will send ou complete file in a day or 2
Rajeev

Thanks
 
Last edited:

rkgoyal_98

Well-Known Member
#5
Dear Soumya and Pramod

Hello

I have modified the formulla to put all the scrips in one file, however i had to remove the header line as it was being added in the middle of file with each ticker. I could not tackel how to put header line only once in the file as file is closed with each ticker and opened in append mode again. Strangel it has made the AFL i bit faster too
Just try
Thanks
 
Last edited:
#6
Dear Rajeev and Soumya,

the new formula from Rajeev is working well. But Irrespective of the existance of data in the given date range, the formula creates the output file. So, If the given range is empty, an empty file will be created. This can be avoided by placing file opening command under the 'if' condition.
Enclosed the modified afl here. try this.

If we want to oexport data for a single day, we modify the second line like this
Buy = ( (DateNum() == 1070131);

Regards,
Pramod.
 

swagat86

Active Member
#7
Export Data from Amibroker to ASCII files

Here there is a formula available to export data from Amibroker to ASCII files. With the formula we can export data for a specified period from Amibroker database.

How to export:

Download,unzip and copy this afl formula file to Amibroker\Formulas\Custom folder.
Scan with the formula in Automatic Analyser (AA) in Amibroker.
The formula will create a folder in C drive named 'OHLC' and will collecte the data in separate text files for each symbol.

Periodicity:

WE can export the data for different periodicity 1min, 5min, 10min or daily etc. as we required. To configure that go to AA > settings > General > Periodicity and set periodicity. Thus we can get data for 5min, 10min, 1 Hour, daily etc.

Select Date Range:

To set the date range, we have to edit the formula.
Open AA > pick (the formula file) > edit.
In the second line we can see:

Buy = ( (DateNum() >= 1061225) AND (DateNum() <= 1070110) );

First DateNum is the start date and second DateNum is end date.
The current settings will export data from 20061225 to 20070110.
Just like that, we can select another date range. Instead of 2006, should give 106 and for 2007, give 107 etc. Month and date are same. Save the formula and scan it.
It will export and save the data in C:\OHLC folder.
If you want to export for an another date range, that will also be added to the corresponding files just after the current data.

Hello Traders,

I request you to use this formula and let me know the feedback.

Thanking you,
Regards,
Pramod.
[email protected]
thanks 4 the AFL bro
 
#9
Export Data from Amibroker to ASCII files

Here there is a formula available to export data from Amibroker to ASCII files. With the formula we can export data for a specified period from Amibroker database.

How to export:

Download,unzip and copy this afl formula file to Amibroker\Formulas\Custom folder.
Scan with the formula in Automatic Analyser (AA) in Amibroker.
The formula will create a folder in C drive named 'OHLC' and will collecte the data in separate text files for each symbol.

Periodicity:

WE can export the data for different periodicity 1min, 5min, 10min or daily etc. as we required. To configure that go to AA > settings > General > Periodicity and set periodicity. Thus we can get data for 5min, 10min, 1 Hour, daily etc.

Select Date Range:

To set the date range, we have to edit the formula.
Open AA > pick (the formula file) > edit.
In the second line we can see:

Buy = ( (DateNum() >= 1061225) AND (DateNum() <= 1070110) );

First DateNum is the start date and second DateNum is end date.
The current settings will export data from 20061225 to 20070110.
Just like that, we can select another date range. Instead of 2006, should give 106 and for 2007, give 107 etc. Month and date are same. Save the formula and scan it.
It will export and save the data in C:\OHLC folder.
If you want to export for an another date range, that will also be added to the corresponding files just after the current data.

Hello Traders,

I request you to use this formula and let me know the feedback.

Thanking you,
Regards,
Pramod.
[email protected]
Thnx for export data afl

Is it possible to import data in amibroker using AFL ?

Harish Chheda
 

Similar threads