Question about two symbols which have different length of price array

0 votes

I have a question about two symbols which have different length of price array. 

My AFL script is as following: 

1. Calculate MA of "SPX" 

2. Calculate MA of "UA" which starts trading from 2016.03.23

SetForeign( "$SPX");

idx_long_ma = MA(C,120);

idx_clos  = C;


sym_stk = Name();  

stk_long_ma = MA(C,120);

stk_clos  = C; 

When I do debugging, it looks like that program will automatically align the two price array from 2016.03.23 and cut the early data of SPX.  And the MA calculation of "SPX" was based on array from 2016.03.23 instead of using earlier data.  This returns "Null" for SPX MA which is not what I want.

Could you elaborate me how to solve this issue? 


Inline image 2

asked Jul 19, 2017 in AmiBroker by anonymous

1 Answer

0 votes
For AFL questions use the forum
answered Jul 21, 2017 by admin (9,260 points)