Problem with nested formulas

eval(LoopAvg(“Ret%Chg(75,CTR, $getXLP)”,5,0,1) < LoopAvg(“Ret%Chg(75,CTR, $getXLY)”,5,0,1), Ticker(“spy”), Ticker(“ief”))

$getXLP = GetSeries(“XLP:usa”)
$getXLY = GetSeries(“XLY:usa”)

error message: Invalid series specified in Ret%Chg

This is a new problem, never had this problem before.

There was a recent change designed to prevent users from using invalid values in series parameters that might have caused this error. We will look into it.

For now, you could write the rule like this:

eval(LoopAvg("Ret%Chg(75,CTR, GetSeries(`XLP:usa`))",5,0,1) < LoopAvg("Ret%Chg(75,CTR, GetSeries(`XLY:usa`))",5,0,1), Ticker("spy"), Ticker("ief"))

Yes, I know that your formula works.

But the problem is much more serious when you have multiple formulas nested. Each of the nested formulas must now be basic formulas. i.e. they cannot reference other formulas.
This recent change will lead to a lot of wasted time in fixing the error.

For example this formula:
$Sentiment = ($XLP_XLY & $NONSYCLICAL_SYCLICAL & $CNS_CND) | $RSPS_RSPD
uses 4 formulas all of which showed the same problem and had to be fixed. Also previously I had to fix $RSPS_RSPD which are new tickers replacing RHS and RCD because the formulas are not updated when ticker symbols are changed.

Also I use $Sentiment in another formula:
$conditionD = ($InflLower & $Sentiment) | $CycAdjust_RiskPremium | $Super_Timer

So the error gets propagated.

That change should be reversed. I am getting errors now in lots of sims whenever I use a formula that references another formula. Also happens in the hedge module.

The problem is not confined to ticker series. Also Imported Data Series are affected.
For example the growth rate of the Conference Board Leading Economic Index which I use for market timing and which I have in a Data Series named LEIg.

This formula used to work:

Eval( sma(5,0,$LEIg)>=-1 | sma(5,0,$LEIg)<-1 & sma(5,0,$LEIg)>-5 & SMA(5,0,$LEIg)>SMA(15,0,$LEIg) , TICKER("XLE XLU XLK XLP VIG XLI XLV "), TICKER(“GLD,XLP,VIG, IAU”) )

with $LEIg = getseries(“LEIg”)

After the functionality of the Custom Formulas has been messed up by your recent change the above does not work anymore, although there is no nesting in the formula or in $LEIg.

To make this work I had to exchange $LEIg for getseries(“LEIg”) into the above formula:

Eval( sma(5,0,getseries(“LEIg”))>=-1 | sma(5,0,getseries(“LEIg”))<-1 & sma(5,0,getseries(“LEIg”))>-5 & SMA(5,0,getseries(“LEIg”))>SMA(15,0,getseries(“LEIg”)) , TICKER("XLE XLU XLK XLP VIG XLI XLV "), TICKER(“GLD,XLP,VIG, IAU”) )

So you have succeeded to remove the benefit of Custom Formulas and make them almost useless.

We reversed out the change for now. There are many misuses of GetSeries and will re-evaluate a solution. Thanks for reporting it.

Thank you for sorting this out.
As a matter of interest, what are these misuses you are referring too?

I will show the misuses in a separate topic because it’s a much wider issue