Issue with Pine Script stdev() function

300 Views Asked by At

I am a little bit confused on how stdev() function in TradingView's script language works.

I am trying to write a C# code that converts the following code block but I am getting different results:

typical=hlc3
f = log( typical ) - log( typical[1] )
g = stdev(f, 30 )

Basically, what I am doing in C# is to create a list of decimal values and then i do a Stdev on the list but I am unable to get the same result.

1

There are 1 best solutions below

0
rumpypumpydumpy On

I believe pine stdev() calcuates population stdev. If you're C# code is calculating sample stdev that might account for the difference (N instead of N - 1)