New Relative Functions Released

Dear All,

The following relative functions have been released and can be used in rules and ranking systems. They greatly facilitate creating a normalized metric comparing the latest value vs. previous historical values. For example you can easily check the valuation of a stock vs. it's historical valuation in terms of z-score or rank.

You will find these functions under our reconfigured reference: Advanced Functions→Relative vs. History.

Let us know what you think. Some examples below.

Thanks

NOTE: We will be using these normalizing functions in our upcoming upgrade of AI factor. Also, I will post a follow up showing that the market is not as over-extended as it seems compared to past 5 years!

Sampling using a "Loop" formula

LoopZScore("formula(CTR)", iterations[, start, increment, clip, NA_value, NA_pct])
Calculates the Z-Score of the latest value vs. all the values.

LoopRank("formula(CTR)", iterations[, start, increment, sort, sort_style, NA_value, NA_pct])
Calculates the percentile rank of the latest value vs. all the values.

LoopRel("formula(CTR)",iterations [, start=0, increment, NA_value, NA_pct])
Calculates the relative value vs. the minimum and the maximum of the samples. The range of values is from 0 to 1.

Sampling using "FHist" function

FHistZScore("formula", samples[, weeks_increment, clip, NA_value, NA_pct])
Calculates the Z-Score of the latest value vs. all the values.

FHistRank("formula", samples[, weeks_increment, sort, sort_style, NA_value, NA_pct])
Calculates the percentile rank of the latest value vs. all the values.

FHistRel("formula", samples[, weeks_increment, sort, NA_value, NA_pct])
Calculates the relative value vs. the minimum and the maximum of the samples. The range of values is from 0 to 1.

Examples

Screen for stocks that are trading at the highest 90% Price to Sales for the past year. The Pr2SalesTTM is sampled 26 times over the past year, with data collected every two weeks, corresponding to a 1-year period.
FHistRank("Pr2SalesTTM", 26, 2) > 90

Screen for stocks that have reported a Gross Margin in the top 90th percentile when compared to the last 20 previously reported values.
LoopRank("GMgn%(CTR, TTM)",20) >= 90

12 Likes

It seems to me that LoopRank and FHistRank set the stage for LoopPercentile and FHistPercentile. LoopPercentile(95) would be the value that would correspond to LoopRank=95. Is this low-hanging fruit? It would be enormously valuable. Currently, there's no way to trim or Winsorize Loop values (except in the Aggregate command). So if you want to get LinReg values for a series that is trimmed or Winsorized by percentile it's extraordinarily difficult, if not impossible. There are other instances in which LoopPercentile would be very valuable.