- ago
Remembered can save a chart in WL6. Cannot find an example in WL7.
0
855
Solved
10 Replies

Reply

Bookmark

Sort
Glitch8
 ( 11.64% )
- ago
#1
Hi Greg, it's no longer supported in WL7 because the Strategy executes disconnected from the chart. You could use the ScottPlot library included in WL7 to render a financial chart, then save it to a file, but it won't look like WL7's chart.
1
- ago
#2
QUOTE:
ScottPlot library included in WL7 to render a financial chart, then save it to a file,...

ScottPlot is an excellent choice, and it's fairly easy to use. You may want to bracket your ScottPlot code in a conditional as shown below so you're not writing Charts for every stock on earth. Take note of the SaveFig(...) parameters.

Of course, you want a financial plot, not a scatter plot as shown below. https://scottplot.net/cookbook/4.1/category/plottable-finance/
CODE:
using ScottPlot; ...    public override void Initialize(BarHistory bars) {       ...       if (ExecutionMode == StrategyExecutionModes.Strategy          && ExecutionDataSetName == null) //only plot stats in single-symbol mode       {             Plot plt = new Plot(700, 500);             plt.Title("Price change vs Volume for " + bars.Symbol);             plt.XLabel("Volume");             plt.YLabel("Price change");             double[] xVol = new double[bars.Count], yPriceChg = new double[bars.Count];             //Color plotColor = plt.GetNextColor();             for (int bar = 1; bar < yPriceChg.Length; bar++)             {                xVol[bar] = bars.Volume[bar];                yPriceChg[bar] = bars.Close[bar] - bars.Close[bar-1];             }             plt.AddScatter(xVol, yPriceChg, lineWidth: 0F);             plt.SaveFig(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\priceChgVsVolume.png");          }       }
0
Best Answer
- ago
#3
Thank Glitch and supersticker for quick answers.
0
- ago
#4
bummer!

I really liked the ability to save Wealth Lab charts programatically. I guess we have to programmatically take screenshots which is going to be a fragile but workable process.
0
- ago
#5
MrHari, did you ever get this working and if so would you be will to share your solution?

Thanks
0
Glitch8
 ( 11.64% )
- ago
#6
I'm working on this for Build 5 now ... GetChartImage for WL8 is looking good so far.
1
- ago
#7
I almost have a script running to take a snapshot of the portion of the screen I want but it is nothing compared to what I anticipate will be in Build 5. Thanks for including it and I will anxiously await the arrive of Build 5.
1
- ago
#8
Tried and saved an image from code.

CODE:
img.Save(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\test.bmp");


Thanks a lot
Greg
0
- ago
#9
GetChartImage () does not return an image using the bar spacing setting in preferences.
0
Cone8
 ( 28.45% )
- ago
#10
At least for now, properties like BarSpacing and ShowVolumePane come from Preferences > Chart. Just set your Preferences to match the chart before running the Strategy.

Are you indicating that it isn't working for you?
0

Reply

Bookmark

Sort