Saving chart bitmap in WL6
Author: traderray
Creation Date: 9/1/2010 9:38 AM
profile picture

traderray

#1
In WLP4 I create a bitmap of several charts and then put them all into a word document. To create the bitmap I use

CODE:
Please log in to see this code.


To create the word document I use

CODE:
Please log in to see this code.


How would I do the equivalent in WLP6?
profile picture

Cone

#2
See GetChartBitmap in the QuickRef for an example.
profile picture

traderray

#3
Thanks Robert, I missed that in the QuickRef.

When do you think this will be working in 64 bit?
profile picture

Eugene

#4
If you don't mind settling with RTF vs. DOC, which would do just fine for a picture and some formatted text, then the following would work on a 64-bit OS. No Interop/Word required too (the resulting RTF opens even in Wordpad):
CODE:
Please log in to see this code.
profile picture

Eugene

#5
jalalfeghhi1 writes:
QUOTE:
Cone, Eugene
I have a system that goes through a number of symbols in a dataset after market close. For each symbol, I want to plot the price action and a bunch of indicators, save the bitmap into a RTF document, and do the same for the next symbol. The problem I ran into is that for the second (next) symbol, I need to close/clear all the existing chart panes before plotting the new symbol along with its indicators. Otherwise, I end up with too many charts in my bitmap, which is hardly readable.

Is there a way to close/clear existing panes within a strategy? If not, could you recommend workarounds?

-Thanks, j


QUOTE:
Eugene,
Good to hear from you. The discussion we had before was related but different, it had to do with hiding and popping open a pane within a strategy.

My current question has to do with completing clearing the chart panes (price pane and all the associated indicator panes) from within a strategy. In my system, I iterate through a number of symbols in a dataset. For each symbol, I plot a few indicators, and then save the associated bitmap (price pane and all the indicator panes) to a RTF file. For the next symbol in the dataset, I need to clear the previous price and indicators first, then plot the new price, indicators, and append this bitmap to the same RTF file. If I can NOT clear the existing price/indicator panes, I end up with one gigantic bitmap that has way too many panes and is hardly readable.

I am not sure what you mean by not plotting the panes when I export to RTF. I need the indicator panes in my RTF report, but I need to remove them before creating new ones for the next symbol.

Please advise.

-Best, J
profile picture

Eugene

#6
And here comes a reasonable question: can we take a look at your code?
profile picture

jalalfeghhi1

#7
Eugene,
Thanks for moving the posting. The following is my logic:

CODE:
Please log in to see this code.


I need to call MyClearPanes() to remove all the existing panes before generating indicators for the next symbol; otherwise I end up with a huge bunch of of panes stacked on top of each other. My issue is that I do not know how to code MyClearPanes() because I don't know how to clear/remove panes within a strategy. Perhaps I can somehow use the pane handler obtained in the call ChartPane pane = CreatePane(40, true, true) in a windows function that deletes the pane? Any other ideas or workarounds?

-thanks, J
profile picture

Eugene

#8
I'm afraid I've no time for guesswork these days. If you need help with this, show us the actual misbehaving code behind the procedures that clears, plots the symbol, and does copying. In other words, not a skeleton, snippet, outline or logic - but the whole code.
profile picture

jalalfeghhi1

#9
Eugene,
Hi, hope you had a nice weekend. Below you can see my sample code. The problem I am having is quite clear in the function MyClearPanes(). I need to call this function to clean up (delete) the existing panes before processing the next symbol. Otherwise, all the price charts superimpose on top of each other and all the indicator panes stack up on top of each other. If I am processing a dataset of 20 symbols and each symbol has 3 indicators, I will end up with a bitmap of 60 panes which is useless. In my report, I would like to have one section for each symbol and analyze it separately from all the other symbols.

The problem I have is that there is no functionality in WLP to clear/delete existing panes:-(

CODE:
Please log in to see this code.
profile picture

Eugene

#10
While looping through the DataSetSymbols, with GetChartBitmap you'll only get the clicked symbol's chart because it's the only rendered image of the chart. I do not have an idea of a workaround currently.
profile picture

jalalfeghhi1

#11
Eugene,
Appreciate your comment. Just to make sure I am not miscommunicating with you:
. I am looking for a way to clear/delete a chartpane. We can create a pane and plot it on in the active window. Is there anyway to delete a plotted indicator from within a strategy?
. Could you think of a windows function that I can pass the chartpane or the current active window as input to clear or delete?
. Can you think of a way that I can restructure my program so that I can generate a bitmap for each symbol in a dataset, in such a way that each bitmap relates to one symbol and does not contain the indicators of other symbols?

-Best, j
profile picture

Eugene

#12
Given that code is structured properly, with Windows functions (whatever they might be) or without them there's no need to delete ChartPanes or clear anything.

The problem, as stated above, is that even in a properly restructured program, GetChartBitmap should not work as you want it to. Unless you're willing to click every symbol of the DataSet manually, saving the clicked symbol's bitmap, there is no rendered image of the chart to save because when looping by DataSetSymbols or running a multi-symbol backtest, that image isn't being created.

Maybe others can share some ideas/workarounds but not me at the present time.
profile picture

jalalfeghhi1

#13
Thanks Eugene
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).