Ошибка при построении BollingerBands
Я взял код BollingerBands из [url]http://stocksharp.codeplex.com/SourceControl/latest#Sources/Algo/Indicators/[/url]
и убрал нижнюю границу, оставив только верхнюю.
[code=csharp]protected override ComplexIndicatorValue OnProcess(IIndicatorValue input)
{
_dev.Process(input);
var maValue = _ma.Process(input);
var value = new ComplexIndicatorValue();
//value.InnerValues.Add(_ma, maValue);
value.InnerValues.Add(UpBand, UpBand.Process(input));
//value.InnerValues.Add(LowBand, LowBand.Process(input));
return value;
}[/code]
В ходе выполнения S# иногда в совершенно разных местах вылетает с ошибкой:
[code=csharp]_dev.Process(input);[/code]
{"Exception of type 'System.OutOfMemoryException' was thrown."}
[quote] at System.Collections.Generic.List1.set_Capacity(Int32 value) at System.Collections.Generic.List1.EnsureCapacity(Int32 min)
at System.Collections.Generic.List1.Insert(Int32 index, T item) at System.Collections.Generic.List1.InsertRange(Int32 index, IEnumerable1 collection) at System.Collections.Generic.List1.AddRange(IEnumerable1 collection) at Ecng.Collections.CollectionHelper.AddRange[T](ICollection1 source, IEnumerable1 items) at StockSharp.Algo.Indicators.Trend.StandardDeviation.OnProcess(IIndicatorValue input) at StockSharp.Algo.Indicators.BaseIndicator1.Process(IIndicatorValue input)
at FP.Charts.FP_BollingerBands.OnProcess(IIndicatorValue input) in m:\Dropbox! algo\S# Projects\FP.Charts\FP.Charts\FP_BollingerBands.cs:line 108
at StockSharp.Algo.Indicators.BaseIndicator1.Process(IIndicatorValue input) at FP.Charts.MainWindow.Draw(Candle candle) in m:\Dropbox\! algo\S# Projects\FP.Charts\FP.Charts\MainWindow.xaml.cs:line 539 at System.Action1.Invoke(T obj)
at Ecng.Common.DelegateHelper.SafeInvoke[T](Action1 handler, T arg) at StockSharp.Algo.Candles.CandleSeries.#=qMxdIYa3Bsy11SYmfze5mBmkQVksyW2TNzHInMIKUlJE=(CandleSeries #=qQwq3zGzAPuA$$qQNZajIxQ==, Candle #=qwpg6PRqnHOi7sGCsq12Xog==) at Ecng.Common.DelegateHelper.SafeInvoke[T1,T2](Action2 handler, T1 arg1, T2 arg2)
at StockSharp.Algo.Candles.CandleManager.#=qHl2buvCznhMcHLmPkFBzUNHx7KDVh_NBvq8jnVxXuDs=.#=qZ9QeckuJia1C_VDrXUUO3A==(Candle #=q$Sm91yqCQSgzLSt$ZSZXpg==)
at #=qMH6zLnDhDP9ZhBC7omAjL3xyt0aVwLaU9CJ1QPs56fiRir9Bcf9C3T55K1WLV8tQAI31UBR2uGjPm9CX99$QVg==.#=qozscmrxxF67oyUzPPl5lZg==(CandleSeries #=q5B4S7s8mey5D3UI1NsWAIw==, #=q5woNPL_Gr4Q$DCyWfM94hQ== #=qqJ6WZerZKfOGFt0IaQyCKA==)
at System.Action2.Invoke(T1 arg1, T2 arg2) at Ecng.Common.DelegateHelper.SafeInvoke[T1,T2](Action2 handler, T1 arg1, T2 arg2)
at StockSharp.Algo.Candles.Compression.CandleBuilder`1.RaiseProcessing(CandleSeries series, Candle candle)[/quote]
S# версии 4.2.2.22 - на 4.2.2.6 такой ошибки нет