Information

Username: mike.ourednik
Member since: 30 Jul 2016
Last login: 30 Jul 2016
Status: Active

Activity

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

Last Algorithm Comments

MI
mike.ourednik · 8 years ago

This is broken. The order of the conditional checks are wrong. It should be

            if (trendDir == 1 && isSwingHigh && High[index] >= lastSwingPrice)
            {
                saveValue = High[index];
                updateHigh = true;
            }
            else if (trendDir == -1 && isSwingLow && Low[index] <= lastSwingPrice)
            {
                saveValue = Low[index];
                updateLow = true;
            }            
        else if (trendDir <= 0 && isSwingHigh)
            {
                saveValue = High[index];
                addHigh = true;
                trendDir = 1;
            }
            else if (trendDir >= 0 && isSwingLow)
            {
                saveValue = Low[index];
                addLow = true;
                trendDir = -1;
            }