Saturday, March 7, 2015

Zig Zag Code

for (shift = limit; shift >= 0; shift--)
            {
                        // Low
                        val = Low[iLowest(NULL, 0, MODE_LOW, ExtDepth, shift)];
                        if (val == lastlow)
                                    val = 0.0;
                        else
                        {
                                    lastlow = val;
                                    if ((Low[shift] - val) > (ExtDeviation*Point))
                                                val = 0.0;
                                    else
                                    {
                                                for (back = 1; back <= ExtBackstep; back++)
                                                {
                                                            res = LowMapBuffer[shift+back];
                                                            if ((res != 0) && (res > val))
                                                                        LowMapBuffer[shift+back] = 0.0;
                                                }
                                    }
                        }
                        if (Low[shift] == val)
                                    LowMapBuffer[shift] = val;
                        else
                                    LowMapBuffer[shift] = 0.0;
                                   
                        // High
                        val = High[iHighest(NULL,0,MODE_HIGH,ExtDepth,shift)];
                        if (val == lasthigh)
                                    val = 0.0;
                        else
                        {
                                    lasthigh = val;
                                    if ((val - High[shift]) > (ExtDeviation*Point)) val = 0.0;
                                    else
                                    {
                                                for (back = 1; back <= ExtBackstep; back++)
                                                {
                                                            res = HighMapBuffer[shift+back];
                                                            if ((res != 0) && (res < val))
                                                                        HighMapBuffer[shift+back] = 0.0;
                                                }
                                    }
                        }
                        if (High[shift] == val)
                                    HighMapBuffer[shift] = val;
                        else
                                    HighMapBuffer[shift] = 0.0;

            }

No comments:

Post a Comment