Problem working with foreign data

Hi Guys!

I have problem working with foreign data captured from Quandl. None of the Data I’ m getting is a usual OHLC. All of them are various data sets showing different trading values, from OI to volume, floating or IV.
I’m getting 8 Data fields for every stock, so I stored them on a New ticket called Quandl-stock ticket using the two user fields provided, from Ami 4.6, and the regular OHLC,V, OI fields.
As I said before, none of the them are properly the stock price. The price, as always, is avalaible only on the usual stock ticket from Ami.
The problem I have is when I make a backtest using Foreign Function for getting those values to compare or look at, I always get the value stored on the Close, and sometimes is not what I need.
So, is there a way to get whatever of the six values, no matter where they are stored in a arbitrary way?


Specify the exact field that you want to retrieve in Foreign()

Allowable data fields: "O" (open), "H" (high), "L" (low), "C" (close), "V" (volume), "I" (open Interest), and for v5.29 and above: "1" (aux1), "2" (aux2)

The previous one had a bug.


When I do a data import with the following configuration:

// Dato1, Dato2, Dato3, Dato4, Dato5, Dato6, Dato7, Dato8
// Open, High, Low, Close , Volume, OpenInt, Aux1, Aux2

// I initialize the variables
TickerO = Foreign ("DatosACTUALIZADOS-" + Name (), "O"); // Dato1

// Now I do another test changing the assignment from Open to Close

// I change the assignment of the values ​​in the .format file
// Dato1, Dato2, Dato3, Dato4, Dato5, Dato6, Dato7, Dato8
// Close, High, Low, Open, Volume, OpenInt, Aux1, Aux2

// I import the data with the change.
// I change the Open parameter to Close in the .afl file

TickerC = Foreign ("DatosACTUALIZADOS-" + Name (), "C"); // Dato1

I see that the backtest results are different.
Does the assignment of values ​​affect the backtest when I import them?
Should the backtest always be done with Close data?

Can you change the parameter from an .afl so you don't have to import every time?
Now Data1 is V or C or I, etc ...

Thanks for your help @NSM51.

Best regards,

// Fichero DatosACTUALIZADOS-GOOGL.csv

1 Like

When you did the import, did you specify that the data was not price data? Otherwise, AmiBroker will assume that all values are positive, and that H is greater than or equal to O, L, C and L is less than or equal to O, H, C.


Good point mradtke, i had a similar problem some weeks ago importing data. How can we tell Ami those data fields are not price data on OHLC format?

There are checkboxes for "No quotation data" and "Allow negative prices" in the Import Wizard, or you can use $NOQUOTES and/or "$ALLOWNEG in your import format file as described here:


Hi @mradtke,

I already use the two parameters in the .format file.

In the end I have created two import files changing the order:
1 - $ FORMAT Date_MDY, Close, High, Low, Open, Volume, OpenInt, Aux1, Aux2, Skip, Skip, Skip
2 - $ FORMAT Date_MDY, Open, High, Low, Close, Volume, OpenInt, Aux1, Aux2, Skip, Skip, Skip

Thanks for your help.

Best regards,

You should just use $ALLOWNEG 1.
$NOQUOTES 1 is for something else. Like when you do NOT import quotes (for example when importing fundamentals).


Hi Tomasz,

I use this parameters:

# Format definition file generated automatically
# by AmiBroker's ASCII Import Wizard

$FORMAT Ticker, Fullname, Close, Skip, Skip, Skip, Skip
$GROUP 255

Thank you.

Best regards,


1 Like

Thanks both of you for the Info. I will consider it from now.

1 Like

@Tomasz: The quote above is from the original post in this thread, so I thought $NOQUOTES would be appropriate.

1 Like

I have created two import files and I have solved the problem.
Thanks for your help @mradtke.

I have put the two parameters that you have indicated.

Best regards,

With "quotes" I mean any data series that is put in OHLCV, OI, Aux1/2 fields regardless if they are really quotes or something else.


Thank you @Tomasz.
I will consider it from now.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.