public class GainAndDrawdown(WealthScript ws, Bars bars, DateTime start, DateTime end, string dividenditemstring)
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using Community.Components;namespace WealthLab.Strategies { public class PerformanceDataDemo : WealthScript { protected override void Execute() { /* Edit string according to your dividend source */ string dividenditemstring = "Dividend (Yahoo! Finance)"; GainAndDrawdown pd = new GainAndDrawdown(this, Bars, Date0, DateBars.Count - 1, dividenditemstring); pd.DisplayData(PricePane); ChartPane ddPane = CreatePane(40, true, true); ChartPane gainPane = CreatePane(60, true, true); PlotSeries(gainPane, pd.GainSeries, Color.Green, LineStyle.Histogram, 1); PlotSeries(gainPane, pd.TotalReturnSeries, Color.Blue, LineStyle.Solid, 2); PlotSeries(ddPane, pd.DrawdownSeries, Color.Red, LineStyle.Histogram, 1); // Compare to a benchmark. Make sure to use sync'd Bars Bars bmbars = GetExternalSymbol("SPY", true); GainAndDrawdown bm = new GainAndDrawdown(this, bmbars, Date0, Datebmbars.Count - 1, dividenditemstring); PlotSeries(gainPane, bm.TotalReturnSeries, Color.Black, LineStyle.Solid, 2); PlotSeries(ddPane, bm.DrawdownSeries, Color.Black, LineStyle.Solid, 2); } } }