Group & GroupVar Problem

GroupVar does not seem to work.

I created a public screen titled: GroupTest using the S&P500 universe.

It seems that the GroupVar and Group are ignored.

I spoke to Mr. Ellis on the phone. The answer to his question was worth sharing, I though.

When you use the @Group variable, it just separates the stocks into one of three groups: Stocks that passed the criteria (@Group=1), stocks that failed the criteria (@Group=0) and stocks that had no pertinent data or otherwise would have erred with that criteria (@Group=NA).

The F-functions will then operate on each of those groups. FMedian(“Price>50”,@Group) will get a median price for companies that are higher than $50, lower than $50 and…I dunno, are trading in yen or something.

The result of this is that

Price>FMedian("Price>50,@Group)

will always be equal to 50% of the universe, because it’s going to be above the group that the company is in.

To get the result that’s sort of implied by selecting a sub-group via @Group, change that rule to:

Price>FMedian("Price>50,@Group) and @Group=1

I’ve never had any luck getting @Group and @GroupVar to work

Hi P123.

I also could not make GroupVar work in a portfolio. Where is the error? These are my rules:

SetVar(@Group, InList(“InRenBonds”))
Eval(InList(“InRenBonds”), FRank(“Close(0)/Close(63)”,#GroupVar, #DESC) < 50, 0)

I intend to rank a couple of ETFs that are in a specific list, and the sell rule should only be valid if they fall out of the top 50% of this group based on the given formula.

Thanks
whotookmynickname

There seems to be a few issues with #GROUPVAR at this time. We’ll review it after formula-weight position sizing is released at the latest.

This might be bigger than just Groupvar. I’m getting errors when using FSum, FCount, etc when calling a variable inside the function. For example:

SetVar(@Div, Yield)
FCount(“@Div”)

Throws the error “value for @Div not found”.

I have also found that when using the F… functions I get errors if I do any universe slimming ahead of them, such as close(0)>9.99

My guess is there is something wrong with the order of operations, especially when setting variables ahead of the F’s.

I assume that you’re using the portfolio; what you described works fine in the screener.

First, I would point out that if you set a custom formula, $Div, then FCount(“$Div”) works just fine.

Second, the portfolio evaluates all of its rules simultaneously. That’s why you’re seeing problems with what was sequential in the screener. If you absolutely, positively need to apply some rules before others then you can use custom formulas, custom universes or logical connectors in your portfolio buy/sell rules to do it.

#GroupVar and #Previous can only be used in screens and custom universes (the documentation was not right about GroupVar). Did a few tests and everything seems to work as intended.

primus: give us more details to see why you are having issues

sthorson: F functions that operate on universe run before the rules. But if the F function has custom variables then it’s run sequentially, so trimming the universe will cause it to fail. That is correct. The error message could be clearer. Perhaps what you really meant is #Previous ?

Marco, yes, I learned that through trial and error. So I dump all the trims into the sauce after, or in the Universe (better solution).

The platform has really come along and I’ve been able to develop workarounds as needed until the next advance comes along. Very happy, all considering… This is a fabulous tool!