LoopAvg with GetSeries

Is there a reason why LoopAvg does not work with GetSeries?

This is from the HELP-Reference
To get the closing price time series of the Russell 1000 enter:
Close(0,GetSeries(“$RUI”))
or
Close(0,$RUI)

Therefore both rules below should work, because they are the same:
LoopAvg(“Close(CTR,GetSeries(”$RUI"))“,6)>LoopAvg(“Close(CTR,GetSeries(”$RUI”))",12)
or
LoopAvg(“Close(CTR,$RUI)”,6)>LoopAvg(“Close(CTR,$RUI)”,12)

But this message is displayed when GetSeries is in the rule:
Error near ‘getseries’: GetSeries - Missing operands
The rule without GetSeries gives no problems.

As it is, one cannot use the Loop commands with custom series.

Nested quotations, pure and simple. I made a custom formula for the GetSeries part, and it seemed to work. (At least, no syntax error. I didn’t check the output.)

Replacing GetSeries(“$RUI”) with custom formula $Get works.
But, how should one have known that? Perhaps in the HELP section this should be mentioned in the LoopXXX description.

Thanks

I think it is the quotes inside of quotes problem.

Has there been a fix on this? I am running into constant issues not being able to reference getseries inside things like frank, fcount, loopsum and so forth.

I have been using the workaround for a while by making separate formulas and then referencing those formulas…works for somethings and not for others and slows down my work by about 3-fold. Spent an hour trying to hammer out a simple formula and eventually just gave up and moved on.

For instance, I wanted to apply a 20 day smoothing period to a 5 day signal of spy return minus bnd return. It sounds very simple but because of the nesting issue of quotes not being allowed inside quotes - lets just say my forehead has imprints of various keyboard keys on it.

It used to be even harder . . . But in short, no. You can’t use a formula in quotes within a formula in quotes. You have to use SetVar or ShowVar if you’re using a screen, universe, or buy or sell rule, and a custom formula if you’re using a ranking system.

However, there are also a large number of time series IDs you can use without GetSeries or quotations. So, for instance, to get a 5-day signal of SPY minus BND without using quotation marks, you’d set your benchmark to BND and then write 100*(Close(0,$SP500)/Close(5,$SP500)-Close(0,#Bench)/Close(5,#Bench)). See the time series IDs under “MISC” in Factor and Function Reference for over a hundred different series you can put after the numeral in Close(barsago [,series]).

Thank you Yuval.

Unfortunately, these methods don’t work well. I have tried and am spending 3x longer and doing half as good a job.

Your formula with BND works within a screen but I need to combine 10 or 20 such items into a single rank which is independent of any screen with an absolute reference to the ETF in question (which are not found in time series IDs). It has been a challenge where at times I have to write a formula and then reference that in aggregate series and then reference that in macro charts - which end up being very inefficient - and in 5 minutes I have burned up my hours allotment of runs because P123 is working 10x harder than it needs to as it daisy chains everything together.

Wouldn’t a very simple solution be to change the syntax of getseries(“”) to something like getseries(**)? Thus, it doesn’t get confused with double counting quotes?