Beispiel #1
0
        public string ToShortString()
        {
            var outstring = ";" + SetupId.ToString("000-") + Name;

            outstring += DayTradeDuration == 0 ? ";S;" : ";D;";
            outstring += Symbol + ";" + Allow + ";";
            outstring += TimeFrame > 0 ? TimeFrame.ToString() + ";" : "EOD;";
            outstring += DynamicLoss.HasValue ? DynamicLoss.Value + ";" : ";";
            outstring += StaticLoss.HasValue ? StaticLoss.Value + ";" : ";";
            outstring += StaticGain.HasValue ? StaticGain.Value + ";" : ";";
            outstring += Parameters + ";";
            outstring += Discount + ";";
            outstring += OfflineStartTime.ToShortDateString() + ";";
            outstring += TradesCount.HasValue ? TradesCount + ";" : ";";
            outstring += SharpeRatio.HasValue ? Math.Round(SharpeRatio.Value, 5) + ";" : ";";
            outstring += TotalNetProfit.HasValue ? Math.Round(TotalNetProfit.Value, 5) + ";" : ";";
            outstring += MaxDrawndown.HasValue ? Math.Round(MaxDrawndown.Value, 5) + ";" : ";";
            outstring += Description;
            return(!outstring.Contains("\t") ? outstring : outstring.Substring(0, outstring.IndexOf('\t')));
        }
Beispiel #2
0
        public override string ToString()
        {
            var units = Symbol == null || Symbol.Contains("FUT") ? " (R$): " : " (%): ";

            var outstring = ";" + SetupId.ToString("000-") + Name + "\r\n";

            outstring += DayTradeDuration == 0 ? ";Swing-trade de " + Symbol : ";Day-trade de " + Symbol;
            outstring += TimeFrame > 0 ? ". Tempo Gráfico: " + TimeFrame + ". " : " Gráfico diário.";
            if (DayTradeDuration > 0)
            {
                outstring += " (Bell: " + Math.Round(DayTradeDuration, 2) + ")";
            }
            outstring +=
                Allow == "C" ? "\r\n;Só compras. Slippage: " + Slippage :
                Allow == "V" ? "\r\n;Só vendas. Slippage: " + Slippage : "\r\n;Slippage: " + Slippage;

            if (StaticGain.HasValue)
            {
                outstring += "\r\n;Objetivo fixo inicial: " + StaticGain.Value;
            }
            if (StaticLoss.HasValue)
            {
                outstring += "\r\n;Stop fixo inicial: " + StaticLoss.Value;
            }
            if (DynamicLoss.HasValue)
            {
                outstring += "\r\n;Trailing Stop: " + DynamicLoss.Value;
            }
            if (!string.IsNullOrWhiteSpace(Parameters))
            {
                outstring += "\r\n;Parâmetros: " + Parameters;
            }

            outstring += "\r\n;Simulação de " + OfflineStartTime.ToShortDateString();

            if (TradesCount.HasValue)
            {
                outstring += "\r\n;Operações: " + TradesCount;
            }
            if (TotalCosts.HasValue)
            {
                outstring += " (R$ " + Math.Floor(TotalCosts.Value / 100) / 10 + " k/a.m. em custos. Desconto: " + Discount + "%)";
            }
            if (PositiveTrades.HasValue)
            {
                outstring += "\r\n;" + Math.Round(PositiveTrades.Value, 2) + "% W";
            }
            if (WinLossRatio.HasValue)
            {
                outstring += " (Rácio W/L " + Math.Round(WinLossRatio.Value, 2) + ":1)";
            }
            if (TotalNetProfit.HasValue)
            {
                outstring += "\r\n;Lucro líquido" + units + Math.Round(TotalNetProfit.Value, 2);
            }
            if (DailyNetProfit.HasValue)
            {
                outstring += " (" + Math.Round(DailyNetProfit.Value, 2) + " mensal)";
            }
            if (MaxDrawndown.HasValue)
            {
                outstring += "\r\n;Drawdown máximo" + units + Math.Round(MaxDrawndown.Value, 2);
            }
            if (SharpeRatio.HasValue)
            {
                outstring += "\r\n;Sharpe Ration: " + Math.Round(SharpeRatio.Value, 5);
            }
            if (!string.IsNullOrWhiteSpace(Description))
            {
                outstring += "\r\n;" + Description;
            }
            return(outstring + "\r\n");
        }