Log/Ln Error with Composites

I've run into a problem where I've traced it down to ln/log cannot properly read more than one data point out of internally created industry composites, but works fine on imported tickers (and was working fine until last week when I accidentally erased all composites):


Months = Min( 6, SelectedValue(floor( BarIndex() ) / 21 ));
lbp = 21 * Months;
AnnualizedSlope = ( exp( LinRegSlope( ln( C ), lbp ) ) ^ 252 ) - 1;
ROC126 = ROC(C,lbp);
SumLog = Sum(log(C),lbp);
LogOne = log(C);


This behavior is sporadic, persisting through reloads and reboots. A few minutes ago after doing nothing but reading this forum and rescanning:


The industry composite data is fine, created with the 23 flag set, and is identical in history and appearance to normal imported. Any ideas?

I've not run your code but looking at the first line, there is clearly a misplaced Floor()

You are computing Floor() on BarIndex() and then dividing by 21?
SelectedValue() in AA is the same as LastValue(), just a note as its different from the indicator action.

It would make more sense as

Months = Min( 6, Floor( SelectedValue( BarIndex()) / 21 ));

BarIndex can be values of 0 or a +ve Integer < BarCount.

It may not be "the solution" but it should be corrected.