Example #1
0
 /// <summary>
 /// Resets this indicator and all sub-indicators (StandardDeviation, LowerBand, MiddleBand, UpperBand)
 /// </summary>
 public override void Reset()
 {
     _standardDeviation.Reset();
     LinearRegression.Reset();
     LowerChannel.Reset();
     UpperChannel.Reset();
     base.Reset();
 }
Example #2
0
        private void DoLinearFit()
        {
            m_LinearFitX.Reset();
            m_LinearFitY.Reset();

            // Look for linear movement:
            // x = a + i * b
            // y = a + i * b
            int firstFrameId = m_PreviousPositionFrameIds[0];

            for (int i = 0; i < m_PreviousPositions.Count; i++)
            {
                int deltaFrames = m_PreviousPositionFrameIds[i] - firstFrameId;
                m_LinearFitX.AddDataPoint(deltaFrames, m_PreviousPositions[i].XDouble);
                m_LinearFitY.AddDataPoint(deltaFrames, m_PreviousPositions[i].YDouble);
            }

            m_LinearFitX.Solve();
            m_LinearFitY.Solve();
        }