Remembered can save a chart in WL6. Cannot find an example in WL7.
Rename
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.
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"); } }
Thank Glitch and supersticker for quick answers.
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.
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.
MrHari, did you ever get this working and if so would you be will to share your solution?
Thanks
Thanks
I'm working on this for Build 5 now ... GetChartImage for WL8 is looking good so far.
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.
Tried and saved an image from code.
Thanks a lot
Greg
CODE:
img.Save(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\test.bmp");
Thanks a lot
Greg
GetChartImage () does not return an image using the bar spacing setting in preferences.
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?
Are you indicating that it isn't working for you?
Your Response
Post
Edit Post
Login is required