FHist with StdDev

Can FHist be used with Loopstddev?

FHist is able to be nested inside other Loop functions using variables and returns values for all except Loopstddev. I was wondering if this was known or if there’s a reason for it.

An example screen showing loopstddev with a variable returning 0.00 for all stocks while loopavg works with a variable: https://www.portfolio123.com/app/screen/summary/258694?st=1&mt=1

If it’s not possible, perhaps an FHistStddev function could be added.

The values you’re seeing for the other Loop functions are appearing because the CTR isn’t actually moving. The average, median, etc. are showing up because you’re seeing one result a lot of times. The standard deviation of the results is therefore 0.

In other words, FHist with a CTR variable is meaningless. Try your screen using 0 in place of CTR and you’ll see what I mean.

But it will work with a formula, right?

define $closefhist as fhist(“close(0)”,CTR)

and then use it,

showvar(@fhistdev,loopstddev(“$closefhist”,4))

Yes, in that case CTR works as intended inside a Loop function. Thanks for pointing that out!