public string GenerateHTMLOverview()
{
StringBuilder sb = new StringBuilder();
// Header
sb.AppendLine("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">");
sb.AppendLine("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">");
sb.AppendLine("<head><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\" />");
sb.AppendLine("<title>" + strategyName + "</title>");
sb.AppendLine("<style type=\"text/css\">");
sb.AppendLine("body {padding: 0 10px 10px 10px; margin: 0px; background-color: #fff; color: #003; font-size: 16px}");
sb.AppendLine(".content h1 {font-size: 1.4em;}");
sb.AppendLine(".content h2 {font-size: 1.2em;}");
sb.AppendLine(".content h3 {font-size: 1em;}");
sb.AppendLine(".content p { }");
sb.AppendLine(".content p.fsb_go_top {text-align: center;}");
sb.AppendLine(".fsb_strategy_slot {font-family: sans-serif; width: 30em; margin: 2px auto; text-align: center; background-color: #f3ffff; }");
sb.AppendLine(".fsb_strategy_slot table tr td {text-align: left; color: #033; font-size: 75%;}");
sb.AppendLine(".fsb_properties_slot {color: #fff; padding: 2px 0px; background: #966; }");
sb.AppendLine(".fsb_open_slot {color: #fff; padding: 2px 0; background: #693; }");
sb.AppendLine(".fsb_close_slot {color: #fff; padding: 2px 0; background: #d63; }");
sb.AppendLine(".fsb_open_filter_slot {color: #fff; padding: 2px 0; background: #699;}");
sb.AppendLine(".fsb_close_filter_slot {color: #fff; padding: 2px 0; background: #d99;}");
sb.AppendLine(".fsb_str_indicator {padding: 5px 0; color: #6090c0;}");
sb.AppendLine(".fsb_str_logic {padding-bottom: 5px; color: #066;}");
sb.AppendLine(".fsb_table {margin: 0 auto; border: 2px solid #003; border-collapse: collapse;}");
sb.AppendLine(".fsb_table th {border: 1px solid #006; text-align: center; background: #ccf; border-bottom-width: 2px;}");
sb.AppendLine(".fsb_table td {border: 1px solid #006;}");
sb.AppendLine("</style>");
sb.AppendLine("</head>");
sb.AppendLine("<body>");
sb.AppendLine("<div class=\"content\" id=\"fsb_header\">");
string stage = String.Empty;
if (Data.IsProgramBeta)
stage = " " + Language.T("Beta");
else if (Data.IsProgramRC)
stage = " " + "RC";
sb.AppendLine("<h1>" + Language.T("Strategy Overview") + "</h1>");
sb.AppendLine("<p>");
sb.AppendLine("\t<strong>" + Data.ProgramName + " v" + Data.ProgramVersion + stage + "</strong><br />");
sb.AppendLine("\t" + Language.T("Strategy name") + ": <strong>" + strategyName + "</strong><br />");
sb.AppendLine("\t" + Language.T("Date") + ": " + DateTime.Now);
sb.AppendLine("</p>");
// Contents
sb.AppendLine("<h2 id=\"contents\">" + Language.T("Table of Contents") + "</h2>");
sb.AppendLine("<a href=\"#description\">" + Language.T("Description") + "</a><br />");
sb.AppendLine("<a href=\"#logic\">" + Language.T("Logic") + "</a><br />");
sb.AppendLine("<a href=\"#environment\">" + Language.T("Environment") + "</a><br />");
sb.AppendLine("<a href=\"#properties\">" + Language.T("Strategy Properties") + "</a><br />");
sb.AppendLine("<a href=\"#indicators\">" + Language.T("Indicator Slots") + "</a><br />");
if (Configs.AdditionalStatistics)
{
sb.AppendLine("<a href=\"#statistics\">" + Language.T("Statistic Information") + "</a><br />");
sb.AppendLine("<a href=\"#addstats\">" + Language.T("Additional Statistics") + "</a>");
}
else
{
sb.AppendLine("<a href=\"#statistics\">" + Language.T("Statistic Information") + "</a>");
}
// Description
sb.AppendLine("<h2 id=\"description\">" + Language.T("Description") + "</h2>");
if (Description != String.Empty)
{
string strStrategyDescription = Description;
strStrategyDescription = Description.Replace(Environment.NewLine, "<br />");
strStrategyDescription = strStrategyDescription.Replace("&", "&");
strStrategyDescription = strStrategyDescription.Replace("\"", """);
if(!Data.IsStrDescriptionRelevant())
sb.AppendLine("<p style=\"color: #a00\">" + "(" + Language.T("This description might be outdated!") + ")" + "</p>");
sb.AppendLine("<p>" + strStrategyDescription + "</p>");
sb.AppendLine("<p class=\"fsb_go_top\"><a href=\"#fsb_header\" title=\"" + Language.T("Go to the beginning.") + "\">" + Language.T("Top") + "</a></p>");
}
else
sb.AppendLine("<p>" + Language.T("None") + ".</p>");
// Strategy Logic
sb.AppendLine();
sb.AppendLine("<h2 id=\"logic\">" + Language.T("Logic") + "</h2>");
// Opening
sb.AppendLine("<h3>" + Language.T("Opening (Entry Signal)") + "</h3>");
sb.AppendLine(OpeningLogicHTMLReport().ToString());
// Closing
sb.AppendLine("<h3>" + Language.T("Closing (Exit Signal)") + "</h3>");
sb.AppendLine(ClosingLogicHTMLReport().ToString());
// Averaging
sb.AppendLine("<h3>" + Language.T("Handling of Additional Entry Signals") + "**</h3>");
sb.AppendLine(AveragingHTMLReport().ToString());
// Trading Sizes
sb.AppendLine("<h3>" + Language.T("Trading Size") + "</h3>");
sb.AppendLine(TradingSizeHTMLReport().ToString());
// Protection
sb.AppendLine("<h3>" + Language.T("Permanent Protection") + "</h3>");
if (!Data.Strategy.UsePermanentSL)
{
sb.AppendLine("<p>" + Language.T("The strategy does not provide a permanent loss limitation.") + "</p>");
}
else
{
sb.AppendLine("<p>" + Language.T("The Permanent Stop Loss limits the loss of a position to") + (Data.Strategy.PermanentSLType == PermanentProtectionType.Absolute ? " (Abs) " : " ") + Data.Strategy.PermanentSL);
sb.AppendLine(Language.T("pips per open lot (plus the charged spread and rollover).") + "</p>");
}
if (!Data.Strategy.UsePermanentTP)
{
sb.AppendLine("<p>" + Language.T("The strategy does not use a Permanent Take Profit.") + "</p>");
}
else
{
sb.AppendLine("<p>" + Language.T("The Permanent Take Profit closes a position at") + (Data.Strategy.PermanentTPType == PermanentProtectionType.Absolute ? " (Abs) " : " ") + Data.Strategy.PermanentTP);
sb.AppendLine(Language.T("pips profit.") + "</p>");
}
if (Data.Strategy.UseBreakEven)
{
sb.AppendLine("<p>" + Language.T("The position's Stop Loss will be set to Break Even price when the profit reaches") + " " + Data.Strategy.BreakEven);
sb.AppendLine(Language.T("pips") + "." + "</p>");
}
sb.AppendLine("<p>--------------<br />");
sb.AppendLine("* " + Language.T("Use the indicator value from the previous bar for all asterisk-marked indicators!") + "<br />");
sb.AppendLine("** " + Language.T("The averaging rules apply to the entry signals only. Exit signals close a position. They cannot open, add or reduce one."));
sb.AppendLine("</p>");
sb.AppendLine("<p class=\"fsb_go_top\"><a href=\"#fsb_header\" title=\"" + Language.T("Go to the beginning.") + "\">" + Language.T("Top") + "</a></p>");
// Environment
sb.AppendLine();
sb.AppendLine("<h2 id=\"environment\">" + Language.T("Environment") + "</h2>");
sb.AppendLine(EnvironmentHTMLReport().ToString());
sb.AppendLine("<p class=\"fsb_go_top\"><a href=\"#fsb_header\" title=\"" + Language.T("Go to the beginning.") + "\">" + Language.T("Top") + "</a></p>");
// Strategy properties
sb.AppendLine();
sb.AppendLine("<h2 id=\"properties\">" + Language.T("Strategy Properties") + "</h2>");
sb.AppendLine(StrategyPropertiesHTMLReport().ToString());
sb.AppendLine("<p class=\"fsb_go_top\"><a href=\"#fsb_header\" title=\"" + Language.T("Go to the beginning.") + "\">" + Language.T("Top") + "</a></p>");
// Indicator Slots
sb.AppendLine();
sb.AppendLine("<h2 id=\"indicators\">" + Language.T("Indicator Slots") + "</h2>");
sb.AppendLine("<p>" + Language.T("The slots show the logic for the long positions only.") + " ");
sb.AppendLine(Language.T("Forex Strategy Builder automatically computes the proper logic for the short positions.") + "</p>");
sb.AppendLine(StrategySlotsHTMLReport().ToString());
sb.AppendLine("<p class=\"fsb_go_top\"><a href=\"#fsb_header\" title=\"" + Language.T("Go to the beginning.") + "\">" + Language.T("Top") + "</a></p>");
// Statistic information
sb.AppendLine();
sb.AppendLine("<h2 id=\"statistics\">" + Language.T("Statistic Information") + "</h2>" + Environment.NewLine);
sb.AppendLine(TradingStatsHTMLReport().ToString());
sb.AppendLine("<p class=\"fsb_go_top\"><a href=\"#fsb_header\" title=\"" + Language.T("Go to the beginning.") + "\">" + Language.T("Top") + "</a></p>");
// Additional Statistics
if (Configs.AdditionalStatistics)
{
sb.AppendLine();
sb.AppendLine("<h2 id=\"addstats\">" + Language.T("Additional Statistics") + "</h2>" + Environment.NewLine);
sb.AppendLine(AdditionalStatsHTMLReport().ToString());
sb.AppendLine("<p class=\"fsb_go_top\"><a href=\"#fsb_header\" title=\"" + Language.T("Go to the beginning.") + "\">" + Language.T("Top") + "</a></p>");
}
// Footer
sb.AppendLine("</div></body></html>");
return sb.ToString();
}