Esempio n. 1
0
        protected override void InitForGap()
        {
            if (IsSimple)
            {
                return;
            }

            var firstIndex = Math.Max(m_executeContext.LastIndex + 1, m_executeContext.Index - Period + 1);

            for (var i = firstIndex; i < m_executeContext.Index; i++)
            {
                var source = m_executeContext.GetSourceForGap(i);
                var sma    = m_sma.Execute(source, i);
                var stDev  = m_stDev.Execute(source, i);
            }
        }
Esempio n. 2
0
        protected override void InitForGap()
        {
            if (IsSimple)
            {
                return;
            }

            var firstIndex = Math.Max(m_executeContext.LastIndex + 1, m_executeContext.Index - Period + 1);

            for (var i = firstIndex; i < m_executeContext.Index; i++)
            {
                var source = m_executeContext.GetSourceForGap(i);
                m_source.Add(source);
                m_smaValues.Add(m_smaHandler.Execute(source, i));
            }
        }
Esempio n. 3
0
        private double Calc(double source, int index)
        {
            var result = m_sma.Execute(source, index);

            if (m_queue != null)
            {
                m_queue.Enqueue(result);
                result = m_queue.Dequeue();
            }
            return(result);
        }
Esempio n. 4
0
        private double Calc(double source, int index)
        {
            if (index < Period)
            {
                m_lastResult = m_sma.Execute(source, index);
            }
            else
            {
                m_lastResult = m_k * (source - m_lastResult) + m_lastResult;
            }

            return(m_lastResult);
        }