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?

Thx!

http://amibroker.com/guide/afl/foreign.html

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.

Hello,

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,
Carlos

// Fichero DatosACTUALIZADOS-GOOGL.csv
DATE,Dato1,Dato2,Dato3,Dato4,Dato5,Dato6,Dato7,Dato8
9/21/2020,0.503,0.4951,0.499,0.0289,0.5049,0.5083,0.5066,0.0169
9/18/2020,0.4725,0.4704,0.4714,0.0274,0.4857,0.4918,0.4888,0.0164
9/17/2020,0.4816,0.4791,0.4804,0.0274,0.4875,0.4914,0.4894,0.0134
9/16/2020,0.4705,0.468,0.4692,0.0277,0.4799,0.4841,0.482,0.0129

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.

3 Likes

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: http://www.amibroker.com/guide/d_ascii.html

2 Likes

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,
Carlos

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

2 Likes

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
$SKIPLINES 1
$SEPARATOR ;
$CONT 1
$GROUP 255
$WATCHLIST 298
$AUTOADD 1
$DEBUG 1
$NOQUOTES 1
$ALLOWNEG 1

Thank you.

Best regards,

Carlos

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,
Carlos

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.

2 Likes

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.