Put image to Debug window
Author: traderray
Creation Date: 8/19/2018 4:57 PM
profile picture

traderray

#1
I have a script that creates several panes. I would like to show an image under certain conditions but it is difficult to show it on an exiting pane because of the size. Creating another pane would make the current panes difficult to read.

Is there a way that I can put an image in the Debug Window? I thought about using commentary but that would open a new commentary file each time I run the script. Debug would append the images as I created them and I would have only that window open.
profile picture

Eugene

#2
QUOTE:
Is there a way that I can put an image in the Debug Window?

No way.

QUOTE:
I thought about using commentary but that would open a new commentary file each time I run the script.

Hope this helps: Knowledge Base | Executing some code only once
profile picture

traderray

#3
Eugene,

Thanks for that link. I was not aware of that trick and I certainly look forward to using it in the future.

I did not explain myself well. What I really want is to be able to run the script and see not only the panes produced by the script but the image at the same time. Then I want to go to another symbol, do the same review and on to review more stocks.

I believe I have a way that will work ok but not as good as the debug idea.

Thanks for your help.
profile picture

Eugene

#4
Ray, your objective is still not too clear to me. How would a small window like the Debug tool (by default) help your review by stacking (appending) different images? Why can't you just downsize the image or maximize the chart window. By the way, is the image produced by GetChartBitmap?

If you clarify it we could find something that works for you.
profile picture

superticker

#5
QUOTE:
Hope this helps: Knowledge Base | Executing some code only once
Remember, C# is an object-oriented programming language. So if there's setup code required for your strategy (for example, you want to read a reference file into your own C# collection), you can put that code in the constructor of your strategy (which is the same code block you call CreateParameter in). Just understand this setup code can't depend on any objects created in the Execute() block.

Likewise for cleanup. You can define a destructor for your strategy say for saving "user-defined" state variables to a file. But Microsoft's thinking with the .NET framework is to avoid destructors somewhat and just use data types (such as C# collections) that the .NET framework will automatically destroy when your strategy exits. In other words, try to design your implementation to minimize lines of code (like extraneous destructors), so there's less to go wrong. Let the .NET destructors do this work for you behind the scenes, whenever possible. I have never used a destructor in my strategies.
profile picture

Eugene

#6
QUOTE:
I have never used a destructor in my strategies.

Using destructors in WealthScript Strategy does not fall into 'harmless but useless' category - if you define one it will simply crash Wealth-Lab. It's been this way from the start but wasn't considered an issue when I reported it. There's no good reason to define destructors in WealthScript - just let the GC sort it all out.
profile picture

superticker

#7
QUOTE:
Using destructors in WealthScript Strategy ... will ... crash Wealth-Lab.
I didn't know that. I wonder if that has to do with the implementation of the Execute() block?

Wealth-Lab does write some data to files on exit (I can't say if that's via destructors.), but doing so creates a problem. If Wealth-Lab abends (like when you don't refresh your password fast enough after the market closes), none of those files get written. As a result, restarting WL shows Strategy Monitor data from the day before rather than the current day because the Alerts for the current day were never saved to disk on exit. :(

If you must cache user-defined state variables that need to be saved to disk, I would use write-through caching (not a strategy destructor) to write those changes to disk each time a state variable changes. That way, if WL abends, your state variables are still up to date.

Word processors employ write-through caching somewhat by automatically saving your work periodically. Since word processors can abend, this feature has saved me many times.
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).