weird MovingAverages or dataseries error
weird MovingAverages or dataseries error
26 Mar 2021, 15:52
running on rangebars :
How can this code (happens once in a while maybe 1 out of a few hundred times):
Try
{
i_EMA =(ema > 0)? null : Indicators.ExponentialMovingAverage(Bars.ClosePrices, ema);
}
catch (Exception ex)
{
Print("Err. " + ex.Message + " " + ex.StackTrace.ToString());
}
produce this output:
Output:
An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at cTrader.Automate.Small.V1.Indicator.SmallIndicatorWrapperProvider.GetNested(ISmallChartSource smallChartSource, Type clrIndicatorType, Dictionary`2 parameterValues, AlgoContext algoContext)
at cTrader.Automate.Small.V1.Indicator.SmallIndicatorAccessor.GetInternal[TIndicator](ISmallChartSource chartSource, Object[] parameterValues)
at cTrader.Automate.Small.V1.Indicator.SmallIndicatorAccessor.ExponentialMovingAverage(DataSeries source, Int32 periods)
at cAlgo.WaveSurfer.TuneScheduler(SetHolder thisSet) in c:\Users\xxxxxxx\Documents\cAlgo\Sources\Robots\xxxxxx\xxxxxx\xxxxxxx.cs:line 654
SimpleMA is just the same.
I think there is seriously something wrong with the MovingAverages or dataseries