average return in a custom series & custom universe performance

Hi all,

I have a custom universe of approx. 2800 stocks and want to calculate daily gains/losses of this universe. This should serve as a benchmark.

For this purpose i created a custom series with the custom universe. In rules i ise series and use the following two rules:

setvar(@all,UnivAvg(“close(0)>0”,“close(0)/close(1)”)) // avg gain or loss
Eval(@all<1,1-@all,@all-1) // daily percentage

When I click on ‘totals’, i only get 1 for the first rule instead of 2800. What am I doing wrong?

Also, the cumulative curve only generates gains and no losses (see below).



Hi,

The totals column isn’t a count but the return value of the rule. In this case, the current average value of the price change of the stocks in the universe is 1 (or near 1).

The second rule only returns positive values. I think you want something like;

@all-1

Best,

Walter

Thanks Walter

:slight_smile:

You are not doing anything wrong.

Also multiply Rule 2 by 100 to get pct, then you will not get zero, but the percentage gain/loss from previous day.
(@all-1)*100