CreateAverageForWatchList() question

In the function CreateAverageForWatchList() given here:
https://www.amibroker.com/guide/afl/categorygetsymbols.html

Can someone explain what happens behind the scenes when one of the series is shorter than the others and perhaps offer some suggestions for best practice on how to deal with that?

Best to all,

 John

You need to turn ON padding in the settings and select "reference symbol" to one you want to pad unequal data with. Once you do, missing bars will be padded. Nulls at the beginning can be converted to zeros using Nz() function.

Thanks Tomasz,

I do have padding on and, as I am a US trader, I have selected $SPX as my reference symbol. What I was trying to ask about is the situation where you are averaging say five stocks and they each have different start dates, 1990, 1995, 2000, 2005, and 2010. How does the function handle 2008, when only four stocks have data versus 2018 when there are five histories available?

Best,

 John

The same was as you would do with any average - you divide the sum by the number of non-null (non-empty) components on bar by bar basis.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.