How do I calculate StDev of all bars?

Hello, everyone :smile:

The syntax of StDev is
StDev( ARRAY, periods, Population = True );
So, what if the periods becomes all bars?!
I wrote a code snippet to test it as below:

stDev2 = StDev(C, BarCount); Plot(stDev2, "stDev(C, BarCount)", colorLightGrey, styleLine | styleOwnScale); Plot(BarCount, "BarCount", colorBlueGrey, styleLine | styleOwnScale);

then, I saw the BarCount = a fixed number; stDev2 = {Empty} forever.

:open_mouth: Could any great one know how to calculate StDev of all bars?

Thank you all.

LastValue( StDev( C, BarCount -1 ) );
1 Like