Points each company moves according to its price variation and to its weight in the index

Hello,

How do I build a tabular report in Exploration, which shows me how many points each company moves according to its price variation and to its weight in the index in different time frames?

Thanks and regards,

It is nearly impossible to derive individual symbol movement from index movement because index components’ prices do not need to move in the same direction and do not need to move by same percentage. Imagine index with two components each having 50% weight. The index would move +1% in every following scenario:
a) both symbol A and symbol B grow 1%
b) symbol A grows 2%, symbol B stays unchanged
c) symbol A grows 3%, symbol B falls -1%
and so on and so on

1 Like

Yes, I mean to this… “Imagine index with two components each having 50% weight. The index would move +1% in every following scenario”:
a) both symbol A and symbol B grow 1%
b) symbol A grows 2%, symbol B stays unchanged
c) symbol A grows 3%, symbol B falls -1%
and so on and so on

Based on what each component changes and its weight, how many points of the index each generated?

Thanks Tomasz,

Not the movement from the index, but of each of its components, how many points each one generates.

Amimkt, you would need to know the weight of each stock in your index and have that data in your data feed. Plus every quarter when most major indexes re-balance you will need up your data to be updated to reflect the new weight. For example in the S&P 500 some largest weights on 9/30/2016 were Apple (3.251%), Microsoft (2.395%), ExxonMobil (1.931%) and Amazon.com (1.758%). But since then the Index has rebalanced two or three times.

How will you keep up to date with the most current weights?

Also from time to time the keepers of the Indexes change their methodology. For example, as of today the S&P 500 index is free-float market capitalization weighted. What the heck does that mean? Free-float weighted means that instead of full market cap, only the public float of the company is considered when calculating its weight.

But the weight of S&P 500 have not always been float adjusted. Before 2005, there were not weight factors and the index was pure capitalization weighted.

Does your data source provide you with all the historical and current changes like the above?

Best of luck.

3 Likes

Portfoliobuilder, nice and thank you,

Yes, I have the weights of each stock, are rebalanced every quarter, the advantage is that there are only 35 components of the index, but I would like to create the automatic report.

Thanks and regards,

I don’t fully understand your original post:

I think you are asking how to attribute the performance of an index to each of the components of the index during different historical date ranges.

Set the start and end dates of the exploration in the analysis user interface. Use the Status() function with “firstbarinrange” and “lastbarinrange” to detect the start and end of the historical time period. If you know the price of a stock at the start and end of the date range, you can compute it’s percentage change. If you also know the percentage composition of the index, you can compute the contribution of each component to the index during the date range. It is multiplication.

By the way, you can also backtest a portfolio buy-and-hold strategy with periodic re-balancing. You can create a watchlist with the components of the index and write an AFL formula to conditionally set the position size of each component as a percentage of total equity.

I'll take a stab at coding an Exploration that you may be looking for.

If I understand your question correctly, here is an example Exploration. Let us create a hypothetical Index with two stocks (in this case I am trying to be cute by using two gold stocks, Barrick Gold and Harmony Gold)

Let us assign weights of 60% of the Index is due to Barrick and 40% is due to Harmony.

This formula will look at one day change in price in the two stocks and the hypothetical Index. After calculating the percentage change in each stock we then calculate how many Index points changed due to each of the stocks based upon their weight and their change in price.

BarrickClose = Foreign( "ABX", "C" );
HarmonyClose = Foreign( "HMY", "C" );

WtBarrick = 0.6; // weight of ABX in hypothetical index
WtHarmony = 0.4; // weight of HMY in hypothetical index

IndexClose =  WtBarrick * BarrickClose + WtHarmony * HarmonyClose;

BarrickROC = ROC( BarrickClose, 1 ); // change in price as measured in Percentage
HarmonyROC = ROC( HarmonyClose, 1 );

IndexChange = IndexClose - Ref(IndexClose, -1); // Index change in "POINTS", dollars in this example

IndexPointsFromBarrick = (BarrickROC/100)*(WtBarrick *Ref( BarrickClose,-1));
IndexPointsFromHarmony = (HarmonyROC/100)*(WtHarmony *Ref( HarmonyClose,-1));

Filter = 1;
AddColumn( BarrickClose, "ABX" );
AddColumn( BarrickROC, "ABX change" );
AddColumn( HarmonyClose, "HMY" );
AddColumn( HarmonyROC, "HMY change" );
AddColumn( IndexClose, "Index" );
AddColumn( IndexChange, "Index change in Points", 1.3);
AddColumn( IndexPointsFromBarrick, "ABX pt contribution", 1.3);
AddColumn( IndexPointsFromHarmony, "HMY pt contribution", 1.3);

And a screen capture of the Exploration. You can sum the columns for each stocks contribution and they seem to accurately equal the change in the Index for that day.

3 Likes

You understood me! You did an amazing job!

Now, how to prevent so many columns from appearing? because we would have 35 tickers or more, could it be possible to have a single column that indicates the points that each ticker contributes?

In this case ABX and HMY are the tickers, they should be like row, right?

Thank you very much for all the effort, regards!

Hi Steve,

Apparently I could not explain well, an apology, but you gave me a good idea with your strategy, I’ll think about that!

Thank you very much and regards