- ago
The finantic.InteractiveGraphics Build 2 extension for displaying ScottPlots in a child window does not work with WL Build 94. It worked great with Build 92.

To alternatively generate a pricePlot.png file of the plot below, comment out the lines particular to finantic.InteractiveGraphics (which are the HostPlot lines) and uncomment the lines for generating the *.png file on the Desktop. Be sure to set all the "using statements" right.

Aside: Normally ScottPlot code would be included in the BacktestComplete{block} (or even Cleanup{block}) because you would be using it to plot results from the backtest simulation itself.

CODE:
using System; using WealthLab.Backtest; using WealthLab.Core; using ScottPlot; using finantic.InteractiveGraphics; using Color = System.Drawing.Color; using OHLC = ScottPlot.OHLC; namespace WealthScript13 {    public class TestPlot : UserStrategyBase    {       public override void Initialize(BarHistory bars)       {          PlotHost.Instance.Clear();          Plot plt = PlotHost.Instance.Plot1;          //Plot plt = new ScottPlot.Plot(600, 400);          const int nBars = 70; //number of latest bars to plot          OHLC[] prices = new OHLC[nBars];          for (int idx=0, bar=bars.Count-nBars; idx<nBars; idx++, bar++)          {             prices[idx] = new(bars.Open[bar], bars.High[bar], bars.Low[bar], bars.Close[bar],                bars.DateTimes[bar], TimeSpan.FromDays(1));          }                    // Add a financial chart to the plot using an array of OHLC objects          plt.AddCandlesticks(prices);          plt.XAxis.DateTimeFormat(true);          plt.XAxis.Label("Trading date", Color.Blue);          plt.YAxis.Label("Stock price ($)", Color.Blue);          plt.Title(@"Stock price vs trading days for " + bars.Symbol);          //plt.SaveFig(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\pricePlot.png");          PlotHost.Instance.Refresh();          PlotHost.Instance.SetWindowTitle("Price profile for " + bars.Symbol);       }       public override void Execute(BarHistory bars, int idx) { }    } }
0
140
Solved
1 Replies

Closed

Bookmark

Sort
- ago
#1
Please disregard the above bug report. The finantic.InteractiveGraphics WL extension is working as expected. If you encounter a problem with it, you should try restarting WL to see if that fixes it.
0
Best Answer

Closed

Bookmark

Sort