Intentionally reference to future values (foreign symbol)

Dear All,

I wish to make reference to the future values of markets that closed before US market opens.

Let's say the latest data I have in my US stock database is 18-Jun-2018 and today is 19-Jun-2018 (before 9:00am US time)

However, the most recent data for ^HSI (Hong Kong Index) I import from Amiquote has "19-Jun-2018" as time stamp.

I used the following code to explore the prices.

Filter=1;
hsi=Foreign("^HSI","HSI",1.2);
AddColumn(C,"C",1.2);
AddColumn(ref(hsi,1),"hsi",1.2);

When I click explore with "1 recent bar(s)" selected, in my Result list. I got:

Ticker Date/Time C hsi
SPY 6/18/2018 276.56 30309.49 (this is value from 6/15/2018 HK time, not from 6/19/2018)

Ref(hsi,1) did not allow me to make reference to future value. I also tried TimeFrameGetPrice and valuehwhen but had no luck. Please advise.

Cheers,
Matt

If you want to get future bar value from Foreign symbol, you need to have this FUTURE bar also in CURRENT symbol because Foreign synchronizes and pads data to current symbol as documented in the manual:
http://www.amibroker.com/f?foreign

1 Like

In other words, I cannot really pad future data of a foreign symbol to the current symbol when I have the future bar for the foreign symbol but not the future bar of the current symbol. Am I correct? If this is the case, is it possible to write the lagged values of the foreign symbol to a new user-defined symbol? I tried with AddToComposite but I was not able to lag the future values.

No, you should just do things the OTHER WAY round. Your "current" symbol should be the index and then you can pad "other" data to the index using Foreign().

1 Like