Formula works in screen but not in custom series

Hi all,

I can run the following formula in a screener without problems:

SetVar(@LoopHighest,LoopMax(“Eval(ChaikinAD(63,CTR),CTR,NA)”,63))

When I try to run it as part of a custom series rule, I get the following error:

Aborted! ERROR: In Rule 1: Error near ‘ChaikinAD’: Invalid command ‘ChaikinAD’

Can anybody explain me why this rule doesn’t work in a custom series?

Best regards,
Florian

Hi Florian,

Custom series has two vocabularies; SERIES and STOCK.

Setvar is in the SERIES vocabulary and only accepts functions in that vocabulary. ChaikinAD is in the STOCK vocabulary.

At least that’s how things seem to work.

Best,
Walter

Walter is correct. In the custom series, the stock functions that work on the rest of the site operate within the universe functions that are particular to the custom series tool.

What’s the end goal, given that the series is going to spit out a single number for a single point in time for a single universe? I should lead with noting that you probably can’t do it because of the prohibition on nested quoted strings, but maybe we can get you pretty close.

Hi Paul,

the ultimate goal is a custom series which shows me the ratio of the number of stocks at new 3-month-ChaikinAD highs minus those that have reached a new 3-month-ChaikinAD low, divided by the number of stocks in universe. So the complete rule set looks like this:

SetVar(@LoopHighest,LoopMax(“Eval(ChaikinAD(63,CTR),CTR,NA)”,63))
SetVar(@LoopLowest,LoopMin(“Eval(ChaikinAD(63,CTR),CTR,NA)”,63))
100*(UnivCnt(“@LoopHighest<2”)-UnivCnt(“@LoopLowest<2”))/UnivCnt(“close(0)>0”)

Best regards,
Florian

I just tried it by replacing the SetVars with custom formulas and it seemed to work.

$LoopMax
LoopMax(“Eval(ChaikinAD(63,CTR),CTR,NA)”,63)

$LoopMin
LoopMin(“Eval(ChaikinAD(63,CTR),CTR,NA)”,63)

100*(UnivCnt(“$LoopMax<2”)-UnivCnt(“$LoopMin<2”))/UnivCnt(“close(0)>0”)

Thanks Paul!

This solution works great and is a good workaround for other vocabulary-related issues in the custom series rules.