public string GenerateBBCode()
{
string stage = String.Empty;
if (Data.IsProgramBeta)
stage = " " + Language.T("Beta");
else if (Data.IsProgramRC)
stage = " " + "RC";
string strBBCode = "";
string nl = Environment.NewLine;
string nl2 = Environment.NewLine + Environment.NewLine;
strBBCode += "[b]" + Data.ProgramName + " v" + Data.ProgramVersion + stage + "[/b]" + nl;
strBBCode += "Strategy name: [b]" + strategyName + "[/b]" + nl;
strBBCode += "Exported on: " + DateTime.Now + nl;
strBBCode += nl;
// Description
strBBCode += "[b]Description[/b]" + nl;
if (Description != "")
{
if (!Data.IsStrDescriptionRelevant())
strBBCode += "(This description might be outdated!)" + nl2;
strBBCode += Description + nl2;
}
else
strBBCode += " None." + nl2;
strBBCode += "Market: " + Data.Symbol + " " + Data.PeriodString + nl;
strBBCode += "Spread in pips: " + Data.InstrProperties.Spread + nl;
strBBCode += "Swap Long in " +
(Data.InstrProperties.SwapType == Commission_Type.money ? Data.InstrProperties.PriceIn : Data.InstrProperties.SwapType.ToString()) + ": " +
Data.InstrProperties.SwapLong.ToString() + nl;
strBBCode += "Swap Short in " +
(Data.InstrProperties.SwapType == Commission_Type.money ? Data.InstrProperties.PriceIn : Data.InstrProperties.SwapType.ToString()) + ": " +
Data.InstrProperties.SwapShort.ToString() + nl;
strBBCode += "Commission per " +
Data.InstrProperties.CommissionScope.ToString() + " at " +
(Data.InstrProperties.CommissionTime == Commission_Time.open ? "opening" : "opening and closing") + " in " +
(Data.InstrProperties.CommissionType == Commission_Type.money ? Data.InstrProperties.PriceIn : Data.InstrProperties.CommissionType.ToString()) + ": " +
Data.InstrProperties.Commission.ToString() + nl;
strBBCode += "Slippage in pips: " + Data.InstrProperties.Slippage + nl2;
strBBCode += UseAccountPercentEntry ? "Use account % for margin round to whole lots" + nl : "";
string tradingUnit = UseAccountPercentEntry ? "% of the account for margin" : "";
strBBCode += "Maximum open lots: " + MaxOpenLots + nl;
strBBCode += "Entry lots: " + EntryLots + tradingUnit + nl;
strBBCode += "Adding lots: " + AddingLots + tradingUnit + nl;
strBBCode += "Reducing lots: " + ReducingLots + tradingUnit + nl;
strBBCode += nl;
strBBCode += "Intrabar scanning: " + (Backtester.IsScanPerformed ? "Accomplished" : "Not accomplished") + nl;
strBBCode += "Interpolation method: " + Backtester.InterpolationMethodToString() + nl;
strBBCode += "Ambiguous bars: " + Backtester.AmbiguousBars + nl;
strBBCode += "Tested bars: " + (Backtester.Bars - Data.FirstBar) + nl;
strBBCode += "Balance: [b]" + Backtester.NetBalance + " pips (" + Backtester.NetMoneyBalance.ToString("F2") + " " + Data.InstrProperties.PriceIn + ")[/b]" + nl;
strBBCode += "Minimum account: " + Backtester.MinBalance + " pips (" + Backtester.MinMoneyBalance.ToString("F2") + " " + Data.InstrProperties.PriceIn + ")" + nl;
strBBCode += "Maximum drawdown: " + Backtester.MaxDrawdown + " pips (" + Backtester.MaxMoneyDrawdown.ToString("F2") + " " + Data.InstrProperties.PriceIn + ")" + nl;
strBBCode += "Time in position: " + Backtester.TimeInPosition + " %" + nl;
strBBCode += nl;
if (SameSignalAction == SameDirSignalAction.Add)
strBBCode += "[b]A same direction signal[/b] - [i]Adds to the position[/i]" + nl;
else if (SameSignalAction == SameDirSignalAction.Winner)
strBBCode += "[b]A same direction signal[/b] - [i]Adds to a winning position[/i]" + nl;
else if (SameSignalAction == SameDirSignalAction.Nothing)
strBBCode += "[b]A same direction signal[/b] - [i]Does nothing[/i]" + nl;
if (OppSignalAction == OppositeDirSignalAction.Close)
strBBCode += "[b]An opposite direction signal[/b] - [i]Closes the position[/i]" + nl;
else if (OppSignalAction == OppositeDirSignalAction.Reduce)
strBBCode += "[b]An opposite direction signal[/b] - [i]Reduces the position[/i]" + nl;
else if (OppSignalAction == OppositeDirSignalAction.Reverse)
strBBCode += "[b]An opposite direction signal[/b] - [i]Reverses the position[/i]" + nl;
else
strBBCode += "[b]An opposite direction signal[/b] - [i]Does nothing[/i]" + nl;
strBBCode += "[b]Permanent Stop Loss[/b] - [i]" + (Data.Strategy.UsePermanentSL ? (Data.Strategy.PermanentSLType == PermanentProtectionType.Absolute ? "(Abs) " : "") + Data.Strategy.PermanentSL.ToString() : "None") + "[/i]" + nl;
strBBCode += "[b]Permanent Take Profit[/b] - [i]" + (Data.Strategy.UsePermanentTP ? (Data.Strategy.PermanentTPType == PermanentProtectionType.Absolute ? "(Abs) " : "") + Data.Strategy.PermanentTP.ToString() : "None") + "[/i]" + nl;
//strBBCode += "[b]Break Even[/b] - [i]" + (Data.Strategy.UseBreakEven ? Data.Strategy.BreakEven.ToString() : "None") + "[/i]" + nl;
strBBCode += nl;
// Add the slots.
foreach(IndicatorSlot indSlot in this.indicatorSlot)
{
string slotTypeName;
switch (indSlot.SlotType)
{
case SlotTypes.Open:
slotTypeName = "Opening Point of the Position";
break;
case SlotTypes.OpenFilter:
slotTypeName = "Opening Logic Condition";
break;
case SlotTypes.Close:
slotTypeName = "Closing Point of the Position";
break;
case SlotTypes.CloseFilter:
slotTypeName = "Closing Logic Condition";
break;
default:
slotTypeName = "";
break;
}
strBBCode += "[b][" + slotTypeName + "][/b]" + nl;
strBBCode += "[b][color=blue]" + indSlot.IndicatorName + "[/color][/b]" + nl;
// Add the list params.
foreach (ListParam listParam in indSlot.IndParam.ListParam)
if (listParam.Enabled)
{
if (listParam.Caption == "Logic")
strBBCode += " [b][color=teal]" +
(Configs.UseLogicalGroups && (indSlot.SlotType == SlotTypes.OpenFilter || indSlot.SlotType == SlotTypes.CloseFilter) ?
"[" + (indSlot.LogicalGroup.Length == 1 ? " " + indSlot.LogicalGroup + " " : indSlot.LogicalGroup) + "] " : "") + listParam.Text + "[/color][/b]" + nl;
else
strBBCode += " [b]" + listParam.Caption + "[/b] - [i]" + listParam.Text + "[/i]" + nl;
}
// Add the num params.
foreach(NumericParam numParam in indSlot.IndParam.NumParam)
if (numParam.Enabled)
strBBCode += " [b]" + numParam.Caption + "[/b] - [i]" + numParam.ValueToString + "[/i]" + nl;
// Add the check params.
foreach(CheckParam checkParam in indSlot.IndParam.CheckParam)
if (checkParam.Enabled)
strBBCode += " [b]" + checkParam.Caption + "[/b] - [i]" + (checkParam.Checked ? "Yes" : "No") + "[/i]" + nl;
strBBCode += nl;
}
return strBBCode;
}