Пример #1
0
        private void DescreveSubDado(RichTextBox txt, string titulo, SubSubDado ssd)
        {
            txt.SelectionBullet = false;
            AddQuebraLinha(txt);
            AddTitle(txt, titulo);
            txt.SelectionBullet = true;
            AddText(txt, "Qtd Trades", "" + ssd.nTrades);

            AddText(txt, "Duração Média", "" + ssd.avgDias);
            AddText(txt, "Duração Máxima", "" + ssd.maxDias);
            AddText(txt, "Duração Mínima", "" + ssd.minDias);
            AddText(txt, "Maior Variação", "" + Utils.FormatCurrency(ssd.maxTrade));
            AddText(txt, "Menor Variação", "" + Utils.FormatCurrency(ssd.minTrade));
            AddText(txt, "Variação Total", "" + Utils.FormatCurrency(ssd.total));
            txt.SelectionBullet = false;
        }
Пример #2
0
        private void DescreveDado(RichTextBox txt, SubDado dado)
        {
            txt.SelectionBullet = true;
            AddText(txt, "% Acerto", Utils.FormatCurrency(dado.percAcerto) + "%");
            AddText(txt, "$Win/$Loss", Utils.FormatCurrency(dado.winLossRatio));
            AddText(txt, "Total Ganho", Utils.FormatCurrency(dado.totalGanho));
            AddText(txt, "Total Perdido", Utils.FormatCurrency(dado.totalPerdido));
            AddText(txt, "Trades Stopados", "" + dado.getnTradesStopados());

            txt.SelectionIndent += 10;
            SubSubDado ssd = dado.getTodosTrades();

            DescreveSubDado(txt, "TODOS TRADES:", ssd);
            ssd = dado.getTradesGanhos();
            DescreveSubDado(txt, "TRADES GANHOS:", ssd);
            ssd = dado.getTradesPerdidos();
            DescreveSubDado(txt, "TRADES PERDIDOS:", ssd);
            txt.SelectionIndent -= 10;
        }
Пример #3
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();
            }
        }