Hi guys,
I'm trying to save charts for every symbol at the end of the simulation, without having to develop a plugin. Can you show me an easy way to do this? I have Build 57.
The sample plug in code is a bit confusing.
Save chart images from code
System results plugins can now save chart images to files. The API to call for this is the FinalSystemResults.SaveImage method. A full sample of a plugin that saves chart images can be found in the RightEdgePlugins samples. You can access the samples from the Help\RightEdge Samples menu item. For this feature, see SaveChartImage.cs under the RightEdgePlugins\SystemResults folder in the samples.
If I understood the Plugin sample, I'm supposed to declare a variable
FinalSystemResults _systemResults;
How do I assign a value to this variable??
I tried
_systemResults=new FinalSystemResults();
, but I get an error.
Got the following code in the SystemBase Shutdown section:
foreach(var symbol in _systemResults.SystemData.Symbols)
{
var bars=_systemResults.GetBars(symbol);
int numBars=bars.Count;
DateTime startTime=bars.LookBack(numBars-1).BarStartTime;
DateTime endTime=bars.Current.BarStartTime;
string path="C:\\Users\\Carlos\\RightEdge";
path=path + "\\" + symbol.ToString() + ".png";
using (var stream = File.OpenWrite(path))
{
_systemResults.SaveImage(symbol, bars, startTime, endTime, 1000, 780,
ImageFormat.Png, stream);
}
}