// CALCULATION HANDLING
        internal static PropertyGrid PropertyGridParams(FiveMinsGradientFigureParam param, int height)
        {
            var pg = new PropertyGrid();

            pg.ToolbarVisible        = false;
            pg.PropertySort          = PropertySort.NoSort;
            pg.Size                  = new Size(150, height);
            pg.Location              = new Point(20, 12);
            pg.SelectedObject        = param;
            pg.PropertyValueChanged += OnParamSettingChange;

            return(pg);
        }
Example #2
0
        //Compute per Gunther's notes
        internal static void FindFiveMinsGradientsFigurePGF(ref AllTable[] atRows, FiveMinsGradientFigureParam calcFiveMinsGradientFigureParam, int startRow, int endRow, out string[] auditSummary)
        {
            string auditSegment;

            auditSummary = new string[] { };

            //prefill APpg column 13 with 1's
            for (int i = startRow; i <= endRow; i++)  // 10298 -> 10401
            {
                atRows[i].APpg = 1;
            }
            //col 15
            for (int i = startRow; i <= endRow; i++)  // 10298 -> 10401
            {
                atRows[i].PGFrowx15 = atRows[i].PGa / atRows[i].APpg;
            }
            //col16
            for (int i = startRow; i <= endRow - 1; i++)  // 10298 -> 10400
            {
                atRows[i].PGFrowx16 = (atRows[i].PGa * atRows[i + 1].PGa) / atRows[i].APpg;
            }
            //col17
            for (int i = startRow; i <= endRow - 2; i++)  // 10298 -> 10399
            {
                atRows[i].PGFrowx17 = (atRows[i].PGa * atRows[i + 1].PGa * atRows[i + 2].PGa) / atRows[i].APpg;
            }
            auditSegment = $"FindFiveMinsGradientsFigurePGF:\nColumns APpg, PGFrowx15, PGFrowx16, PGFrowx17 filled from row {startRow}-{endRow}.\nPlease inspect the view.";

            // from Gunther
            //2) look in the fields of columns 15 to17 and the PRECEDING Z rows for the biggest figure. Z = 104 … 999
            //   Z is a variable the user can choose.

            for (int i = startRow; i <= endRow; i++)
            {
                //find biggest figure in the preceding Z rows amongst PGFrowx15, PGFrowx16, PGFrowx17
                double biggest;
                biggest = BiggestPrecedingPGF(ref atRows, i, calcFiveMinsGradientFigureParam.Z);
                if (biggest > 1.0)
                {
                    //atRows[i].APpg *= (1 + calcFiveMinsGradientFigureParam.Y);
                    //continue increasing APpg value onwards to the last row
                    for (int j = i; j <= endRow - 2; j++)
                    {
                        atRows[j].APpg *= (1 + calcFiveMinsGradientFigureParam.Y);

                        atRows[j].PGFrowx15 = atRows[j].PGa / atRows[j].APpg;
                        atRows[j].PGFrowx16 = (atRows[j].PGa * atRows[j + 1].PGa) / atRows[j].APpg;
                        atRows[j].PGFrowx17 = (atRows[i].PGa * atRows[j + 1].PGa * atRows[j + 2].PGa) / atRows[j].APpg;
                    }
                }
                else
                {
                    //atRows[i].APpg *= Math.Pow(1 - calcFiveMinsGradientFigureParam.Y, calcFiveMinsGradientFigureParam.X);
                    //continue declining APpg value onwards to the last row
                    for (int j = i; j <= endRow - 2; j++)
                    {
                        atRows[j].APpg *= Math.Pow(1 - calcFiveMinsGradientFigureParam.Y, calcFiveMinsGradientFigureParam.X);

                        atRows[j].PGFrowx15 = atRows[j].PGa / atRows[j].APpg;
                        atRows[j].PGFrowx16 = (atRows[j].PGa * atRows[j + 1].PGa) / atRows[j].APpg;
                        atRows[j].PGFrowx17 = (atRows[i].PGa * atRows[j + 1].PGa * atRows[j + 2].PGa) / atRows[j].APpg;
                    }
                }
            }
        }