Data Differences Between CSI Source & Amibroker Import via Metastock Plugin

I use CSI data for US stocks and the Metastock plugin to import to Amibroker. The plugin works smoothly. I have CSI back-adjust prices for splits & dividends.

I've noticed differences between the CSI source data and the Metastock plugin data for the adjusted prices of long-history US stocks.

I welcome any tips on how to resolve the differences between my CSI source data and the data imported to Amibroker via the Metastock plugin.

Are there any settings I can adjust to make the CSI & Amibroker data very closely match?


In the attached Excel screenshot image I include earliest (1980) and latest (2021) data for AAPL. Right-click on image and open in new tab to enlarge.

For the earliest data (Rows 2:22), the data imported to Amibroker seems to be rounded to two decimal places (Col. C).

Data differences are easier to notice on a daily-percentage-change basis in Cols. G,H,I.

For the 1st daily percent change (Row 3) the rounded imported data yields a -0.01 daily change in Amibroker which is a -10% drop (Col. G) but the CSI daily percent change is only -5.2% (Col. I).

There are many daily percentage change differences of 4% & 5% in the earliest data (1980s).

Daily percentage change differences of 1% & 2% appear as recently as 2003 (not shown).

In the last row of data you can see 0.00000427 added to the import (Col. C) versus CSI (Col. E) – this may just be single-precision 'noise'.

Again, thanks for any tips on resolving these data differences.
AAPL Excel Image

You will have to work with unadjusted close prices since the close price in CSI is rounded.

The problem is with the splits. As you can see, 12-12-1980, the close is 0.13

However, that is not correct. The unadjusted close was 28.75

AAPL historicaly has 5 splits.

2, 2, 2, 7, 4

So if you would take the unadjusted close and split it 5 times you would end up with a closing price of


I do not know if CSI can work with those prices, I also do not know if AB can work with those prices (I tested it using the quote editor, it will be able to have 0.12345678 )

But that is where your percentage differences come from. The smaller the number, the bigger the percentage difference it will be. It will make many calculations useless.

1 Like

Thanks, Henri

I agree with your calc that the 2, 2, 2, 7, 4 split adjusted closing price would be 0.128348214

CSI's back-adjuster has one option to adjust for splits and another for dividends, & capital gains (see image below). As noted, the 2nd adjustment may cause series to go negative so there is a third option to address that (see red box in image). That is why CSI has 0.1004576 as the 12/12/80 close instead of 0.128348214 (without the third box checked the series does go negative).

I'm satisfied with the adjusted CSI 0.1004576 close – what I seek is to have the Metastock plugin pull that value into Amibroker. I don't know why this isn't happening – why 0.1004576 is imported as 0.10000000. I'd expect at least the first 6-7 imported decimal places to match CSI and that's good enough for me.

AAPL CSI Settings

Henri – if I uncheck the 2nd & 3rd CSI adjustments and do splits only, I match your calc to 8 decimals: 0.12834821

It is NOT about import. It is about EXPORT. About what CSI Unfair Advantage is EXPORTING in text format.

You need to ask CSI on that. They wrote Unfair Advantage and they control how they export data. What they are doing is they are writing TEXT files that later are imported using ASCII importer. Depending on data precision on writing (UA part) you might have prices rounded to different number of decimal places. Ask CSI - most likely their export is limited to 2 decimal places.

Metastock format on the other hand is BINARY (floating point) and always uses pretty much same precision (about 7 significant digits)

The "fix" is on UA side - they should be exporting data without rounding.

Tomasz – Thanks for the quick reply.

I'm still confused – All the files I am importing to Amibroker are in CSI's Metastock binary format – no text, no CSV.

For example, below are the settings for AAPL export – only the Metastock format box is checked (red box).

When I go to the CSI Metastock export directory on my PC, I can see that all files are binary – no text.

In Amibroker, I select "File / Import Metastock data" and point to the MASTER file in the CSI Metastock export directory (see image below). All data is rapidly imported. So I'm importing Metastock binary files.

It is NOT about Metastock format. You wrote:

I've noticed differences between the CSI source data and the Metastock plugin data for the adjusted prices of long-history US stocks.

As I understand you are comparing (1) Unfair Advantage built in "AmiBroker export" as documented here CSI's Unfair Advantage How-To Guide: How do I get my data into AmiBroker?

to data that you (2) manually export to Metastock format and import using MS importer.

What I am saying that while (2) uses binary data, the (1) uses TEXT data that are being exported by Unfair Advantage to TEXT FORMAT likely rounded to 2 decimal places.

AmiBroker AT NO POINT does ANY rounding to imported data. Neither ASCII nor Metastock If you see rounding it happens OUTSIDE OF AmiBroker.


That is a portfolio setting, that will very likely solve your problem.

Thanks for the suggestion – Already checked that box.

And your data is still not imported correctly ?

I cheched the exported files that I have, it is now with 8 decimal precision. But that is an export to CSV.


It might be that CSI does not export to Metastock format using that precision. You could instead of exporting to Metastock use the export to CSV and then import those files.

It's a workaround that will work but you will have to change your routine. I personaly would do that since it will give you better control over your files (you can actualy read them :wink: ) but I have no idea if there is any advantage in using Metastock format that you will then miss....

1 Like

@Henri – Data from Metastock file with UA maximal precision box checked is not coming in correctly to Amibroker.

Your idea about using CSV files works. The beauty of the Metastock plugin is that after I update UA, I start Amibroker and all the new data is there.

As a test, I created a new UA portfolio with just AAPL. I checked UA File Export Preferences boxes for both ASCII & MS so both files, CSV & MS, are created in the new portfolio directory.

Then I created a new Amibroker DB and (1) used the import wizard to import AAPL.CSV – everything is fine. (2) Then I deleted AAPL in Amibroker and used Amibroker File / Import Metastock data – all closes seem to be rounded to 2 decimals plus some noise in decimal places 6,7,8.

I will take this up with CSI & verify that 8 decimals of precision are in the MS file, I will also ask for MS binary file format to see if I can read the AAPL MS file to examine what's being imported.

Thanks for all your ideas – I’ll let you know what CSI says – It may take a few days or so.

β€”Best, Steve O

I think that if you wish to have not only accurate and max precision equities data, with AB integration and symbol organization, then I strongly suggest you try Norgate's products. I think it will prove to be quite eye opening IMHO.

1 Like

@henri β€” @Tomasz suggestion, I tested CSI's CSV to Amibroker export per CSI's instructions & it works well.

So I decide to use CSI CSV files since I can easily inspect them.

I will skip contacting CSI about their Metastock format.