Let's take 3 ETF's : AAXJ,BWV and EWN. I want to get the start date, first 
close etc. of each time series by using SetForeign. What's wrong with the 
following code ? It looks as if AB is using the selected symbol and not the 
symbol from the SETFOREIGN ... Must be something very simple but ...

SetBarsRequired(sbrAll,sbrAll);

SetForeign("AAXJ");
printf("Symbol "+Name()+"\n");
printf("First Close "+WriteVal(Close[0])+"\n");
printf("Last Close "+WriteVal(Close[BarCount-1])+"\n");
printf("Total Bars "+WriteVal(BarCount-1)+"\n");
printf("Start Date "+WriteVal( BeginValue( DateTime() ), formatDateTime )+"\n");

SetForeign("BWV");
printf("Symbol "+Name()+"\n");
printf("First Close "+WriteVal(Close[0])+"\n");
printf("Last Close "+WriteVal(Close[BarCount-1])+"\n");
printf("Total Bars "+WriteVal(BarCount-1)+"\n");
printf("Start Date "+WriteVal( BeginValue( DateTime() ), formatDateTime )+"\n");

SetForeign("EWN");
printf("Symbol "+Name()+"\n");
printf("First Close "+WriteVal(Close[0])+"\n");
printf("Last Close "+WriteVal(Close[BarCount-1])+"\n");
printf("Total Bars "+WriteVal(BarCount-1)+"\n");
printf("Start Date "+WriteVal( BeginValue( DateTime() ), formatDateTime )+"\n");

Regards, Ton.

Reply via email to