Showing posts with label Code Logic. Show all posts
Showing posts with label Code Logic. Show all posts

Friday, March 27, 2015

Calender Dating

The calender dating is a method of numbering the days of the week and the week of the month. This unique numbering is done so that specific days or specific weeks of the month can easily be called for doing additional time specific analytics. 

The following picture shows the methodology the number the trading days of the month. One method uses a consecutive numbering method and the other uses the week and day method.




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;

            }