Iterate through a DataSetSymbols list and save chart bitmap images
Author: jonludwig
Creation Date: 7/29/2011 12:47 PM
profile picture

jonludwig

#1
Any idea how I can do this? When I try it, only the first symbol's chart is saved. All other symbols seem to have the same chart bitmap image as the first.
profile picture

elliottp

#2
Eugene -- any ideas on this? I think what's going on is that a strategy's chart rendering only seems to work for the first symbol in the DataSet, because subsequent symbols (when running "run on all symbols") do not have any active GDI surface to draw on.

I made a workaround that functions 50% -- like this:

CODE:
Please log in to see this code.


We have to store and get the ChartStyle from the 1st symbol since subsequent symbols have a NULL ChartStyle property.

This works, but doesn't seem to allow me to modify the appearance on individual bars in the renderer. I would like to be able to set the background for bars and the color of bars, as well as plot moving averages. There doesn't seem to be any documentation on the ChartRenderer...
profile picture

elliottp

#3
Okay, so I found out some bizarre behavior. The ChartStyle is NULL if you try to run on all symbols in a DataSet. However, if you click on the first symbol, and then click on the DataSet, and then do "run on all symbols", WealthLab remembers the ChartStyle for the first symbol and it is not null -- then it can be used with the code above to render charts for all subsequent symbols in the DataSet.

Unfortunately, I can't find a way to crash my script if I detect that ChartStyle is NULL. Seems in multi-symbol mode WL eats exceptions.

Any ideas to resolve these issues programmatically?
profile picture

Eugene

#4
QUOTE:
There doesn't seem to be any documentation on the ChartRenderer...

Whatever you didn't find covered in the QuickRef and/or the Development Guide in the Wiki, including the ChartRenderer, is not supported. You're using it at your risk so to say.
QUOTE:
because subsequent symbols (when running "run on all symbols") do not have any active GDI surface to draw on.

Right on the money, this is by design. Sorry I have no ideas.
profile picture

elliottp

#5
Solved it :). If anyone else wants to do this, here's a way (hacky code, but it works). You have to first display a chart with the first symbol in the basket to ensure that ChartStyle is not null, and then you can run it the basket.

CODE:
Please log in to see this code.

This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).