Information

Username: jin64t
Member since: 19 Apr 2018
Last login: 19 Apr 2018
Status: Active

Activity

Where Created Comments
Algorithms 0 1
Forum Topics 0 0
Jobs 0 0

Last Algorithm Comments

JI
jin64t · 6 years ago

Hi, perhaps you can fix as follows.

Factor may be calculated as follows.

Factor = 2.0 / (1.0 + 0.5 * Period);

         private double Highest(IndicatorDataSeries macd, int index)
        {
            double dblhigh = macd[index - Period];
            for (int i = index - Period + 1; i <= index; i++)
            {
                if (macd[i] > dblhigh)
                    dblhigh = macd[i];
            }
            return dblhigh;
        }

        private double Lowest(IndicatorDataSeries macd, int index)
        {
            double dbllow = macd[index - Period];
            for (int i = index - Period + 1; i <= index; i++)
            {
                if (macd[i] < dbllow)
                    dbllow = macd[i];
            }
            return dbllow;
        }

Cheers