#### Standard Deviation RList

Posted By johan 4 Years Ago

## Standard Deviation RList

 Message Posted Saturday November 08 2014 I have a RList with daily Equity Values.  I want to calculate a standard deviation on these.  STDev uses a series as input, and not a list.  Is there any way to calculate a standard deviation for a list? Posted Saturday November 08 2014 Try googling "c# standard deviation". If Rlist meets the criteria of a generic list this might help:http://www.martijnkooij.nl/2013/04/csharp-math-mean-variance-and-standard-deviation/ There are others. -PeteSee also Yahoo group about applying RE. Posted Saturday November 08 2014 RightEdge has a class called StdDevQueue which can do this for you.  Let us know if you need any help with using it.Thanks,Daniel Posted Sunday November 09 2014 Thanks Daniel.  How do I set the inputs for StdDevQueue.  I have the following code snippets relevant to thispublic class MySystem : MySystemBasepublic RList ExcessDailyReturn;public StdDevQueue equitySTD;base.NewBar();excessDailyReturn = ((EquityList.Current - EquityList.LookBack(1)) / EquityList.LookBack(1)) - riskFreeRate / 252;ExcessDailyReturn.Add(excessDailyReturn); equitySTD = new StdDevQueue(30);I now want to set the input for equitySTD as RList ExcessDailyReturn.  Can you please help with this.ThanksJohan Posted Sunday November 09 2014 DanielI got it right with AddValue.  My only problem now is that I want to get the Standard Deviation for the whole RList.  When I create the instance, I need to add the number of periods.  Is there a way to let the number of periods equal the whole queue? Posted Monday November 10 2014 If you specify int.MaxValue for the number of periods, then the StdDev property value will be the standard deviation of all the values you've added (assuming you don't go over 2 billion of them).Personally, I think it's probably better to calculate over a fixed period.  If you have a lot of historical data, eventually the data from the beginning of time is going to be less relevant than the more recent data.Thanks,Daniel

## Reading This Topic

2005-2018 © RightEdge Systems