How to display data from extra ticker in an indicator pane of the original ticker?

Hello,

I use the formula:
Plot( Aux1, "Aux1", colorRed );
Plot(Aux2, "Aux2", colorDarkBlue );
in both original ticker and extra ticker and it works – I have nice graphs based on values stored in Aux1 and Aux2 fields of both tickers.

Now I want to display Aux1 and Aux2 data from the extra ticker as a graph in a pane of the original ticker.
I tried to use the formula:
myVal = Foreign( Name() +"_extra", "C");

changing it to: myVal = Foreign( Name() +"_extra", "Aux1");
and: myVal = Foreign( Name() +"_extra", "Aux2");

a new pane appeared, but unfortunately no graph appeared in the pane.

Where have I made a mistake?

Best,
Mariusz

@Mariusz looking at the Foreign() documentation shows that you should specify the Aux field in a different way when used in a Foreign call:

fAux1 =  Foreign( "QQQ", "1"); 
fAux2 =  Foreign( "QQQ", "2"); 
Plot(fAux1, "Foreign Aux1", colorBlue, styleHistogram);
Plot(fAux2, "foreign Aux2", colorRed, styleHistogram);

.... Allowable data fields: ... and for v5.29 and above: "1" (aux1), "2" (aux2)

1 Like

Dear Beppe,

Thank you very much for your help!

I used formula myVal = Foreign( Name() +"_extra", "C");
because I found it on this site: http://www.amibroker.com/kb/2015/01/29/importing-auxilliary-data-into-amibroker-database/

As I understand, the "QQQ"in your formula should be replaced by the ticker, so I did it. The formula looks as follows:
fAux1 = Foreign( "CHRIS/CME_EC1_extra", "1");
fAux2 = Foreign( "CHRIS/CME_EC1_extra", "2");
Plot(fAux1, "Foreign Aux1", colorOrange, styleLine);
Plot(fAux2, "Foreign Aux2", colorGreen, styleLine);

But there is one problem - I want to plot these graphs in the windows of several instruments (EUR, AUD, GBP and so on) basing on the data stored in Aux1 and Aux2 fields of each particular instrument. Instead, I got everywhere graph based on Aux1 and Aux2 fields of EUR.

Could you please tell me what should be written instead as “QQQ” to make it possible to plot data for each particular instrument, basing on the Aux1 and Aux2 fields of each particular instrument?

Best regards,

Mariusz

@Mariusz

"QQQ" was only one sample ticker to show the syntax how to retrieve the Aux fields data in the Foreign() call.

Let's suppose you are plotting such ticker in the main chart (again "QQQ" is just an example, use any normal ticker that you want - not the "_extra" ones).

If you assign/apply the following code to a new pane:

fAux1 = Foreign( Name() + "_extra", "1");
fAux2 = Foreign( Name() + "_extra", "2");
Plot(fAux1, Name() + "_extra Aux1", colorOrange, styleLine);
Plot(fAux2, Name() + "_extra Aux2", colorGreen, styleLine);

in the pane you should see the plot of the Aux1 and Aux2 data stored in your database in the ticker "QQQ_extra".
(Obviously in your database you should have the "_extra" tickers and their Aux data.)

When you change the selected ticker, let's say to SPY, the above formula will refer to "SPY_extra" Aux fields, and so on.

So the above formula will select the foreign "Aux" fields to display based on the ticker that is currently selected in the active tab.

It is not clear to me what you mean by "want to plot these graphs in the windows of several instruments (EUR, AUD, GBP and so on) basing on the data stored in Aux1 and Aux2 fields of each particular instrument. I got everywhere graph based on Aux1 and Aux2 fields of EUR."

If the above explanation is not enough, maybe you should post a picture of the layout that you want to achieve (add text notes where it is wrong and what it should display instead) plus the AFL code that you are using. This will allow us to understand your issue better and provide more guidance to solve it.

I was looking this post this morning from by Mobile @beppe and me too, I confuse what @Mariusz looking for?

My mind goes that maybe he ask some think simpler. i hope is this what he is looking for..

According to the subject if you paste this code you can have the extra and the original ticker in one indicator panel (graphic chart)

// This is for the extra ticker (Symbol)
fAux1 = Foreign( "QQQ", "1");
Plot(fAux1, "Foreign Aux1", colorOrange, styleLine);

// This is for the original ticker (Symbol)
Plot(Aux1, Name() + " current original Aux1", colorBlue, styleLine);

maybe later on you need to use below line that use styleOwnScale if the price of your chart is shring

Plot( Aux1, "Aux1 of  ticker "+ name()+"=", colorLightBlue, styleLine|styleOwnScale );  // this line use styleOwnScale

Dear Beppe,

Once again thanks a lot for your help!

I have no idea about coding; moreover, I have only a little idea about computers :slight_smile: this is a reason I was not precise enough.

Now everything works perfectly well.

Thank you,

Mariusz

Dear PanoS,

Thanks a lot for the interest you showed and your effort to help me.

All the best,

Mariusz