Esempio n. 1
0
        internal void AnalisaEntradas()
        {
            DataGridViewRowCollection RowsEntradas = frmFront.GetRows("dataGridEntradas");

            RowsEntradas.Clear();
            //TODO: continuar daqui
        }
Esempio n. 2
0
        public void UpdateApplication(Carteira carteira, MonteCarlo mC, int countLoops, int totalLoops)
        {
            Application.DoEvents();
            if (totalLoops <= 0)
            {
                totalLoops = 1;
            }
            if (countLoops <= 1)
            {
                _totalDif   = 0;
                _validCount = 0;
            }


            float dif = carteira.GetCapital() - carteira.capitalInicial;

            if (dif != 0)
            {
                _totalDif += dif;
                _validCount++;
            }
            if (_validCount > 0)
            {
                frmPrincipal.SetText("labelAvgDif", "Avg.Dif.:" + Utils.FormatCurrency(_totalDif / _validCount) + " (" + _validCount + ")");
            }



            frmPrincipal.SetText("labelStatus", countLoops + " / " + totalLoops);
            //frmPrincipal.dataSetBacktest.Tables[0].Rows.Add(mC);
            //DataGridViewRow row = new DataGridViewRow();
            //row.Cells.Add(new DataGridViewCell());
            //frmPrincipal.dataGridRuns.Rows.Add(row);
            DataGridViewRowCollection Rows = frmPrincipal.GetRows("dataGridRuns");

            if (Rows == null)
            {
                return;
            }
            int rowLine = Rows.Count - 1;

            Rows.Add();
            int colIndex = 0;

            contaTestes++;
            SubSubDado todosTrades    = mC.getGlobal().geral.getAmbasPontas().todosTrades;
            SubSubDado tradesGanhos   = mC.getGlobal().geral.getAmbasPontas().tradesGanhos;
            SubSubDado tradesPerdidos = mC.getGlobal().geral.getAmbasPontas().tradesPerdidos;

            Rows[rowLine].Cells[colIndex++].Value = mC;
            Rows[rowLine].Cells[colIndex++].Value = carteira;
            Rows[rowLine].Cells[colIndex++].Value = contaTestes;
            Rows[rowLine].Cells[colIndex++].Value = mC.ToString();

            object objIters   = mC.properties.GetPropriedade(UsoComum.ConstsComuns.OBJ_ITERATIONS);
            int    iterations = (objIters == null ? 1 : (int)objIters);


            Rows[rowLine].Cells[colIndex++].Value = iterations;
            Rows[rowLine].Cells[colIndex++].Value = mC.properties.GetPropriedade(UsoComum.ConstsComuns.OBJ_TOTAL_PROFIT) == null ? 0 : (float)mC.properties.GetPropriedade(UsoComum.ConstsComuns.OBJ_TOTAL_PROFIT) / iterations;
            Rows[rowLine].Cells[colIndex++].Value = mC.properties.GetPropriedade(UsoComum.ConstsComuns.OBJ_TOTAL_LOSS) == null ? 0 : (float)mC.properties.GetPropriedade(UsoComum.ConstsComuns.OBJ_TOTAL_LOSS) / iterations;


            Rows[rowLine].Cells[colIndex++].Value = mC.CalcFitness();
            Rows[rowLine].Cells[colIndex++].Value = mC.getCapitalFinal();
            Rows[rowLine].Cells[colIndex++].Value = mC.getMaxCapital();
            Rows[rowLine].Cells[colIndex++].Value = mC.getMinCapital();
            Rows[rowLine].Cells[colIndex++].Value = mC.winLossRatio;
            Rows[rowLine].Cells[colIndex++].Value = mC.qtdTrades;
            Rows[rowLine].Cells[colIndex++].Value = tradesGanhos.nTrades;
            Rows[rowLine].Cells[colIndex++].Value = tradesPerdidos.nTrades;
            Rows[rowLine].Cells[colIndex++].Value = mC.totalGanho;
            Rows[rowLine].Cells[colIndex++].Value = mC.totalPerdido;
            Rows[rowLine].Cells[colIndex++].Value = mC.percAcerto;
            Rows[rowLine].Cells[colIndex++].Value = mC.capitalUsePercent;
            Rows[rowLine].Cells[colIndex++].Value = todosTrades.maxDias;
            Rows[rowLine].Cells[colIndex++].Value = todosTrades.minDias;
            Rows[rowLine].Cells[colIndex++].Value = todosTrades.avgDias;

            if (Rows.Count > config.maxTestes)
            {
                RemovePiorTeste();
            }
        }